[Wolves] Tar without directory structure
Tom Mortimer-Jones
tmj at tc.bham.ac.uk
Fri Mar 4 11:12:24 GMT 2005
Wayne Morris wrote:
> I'm using tar in a cron job to archive security cam pics
> but when I use tar -cf /home/test/campics/images.tar
> /home/test/campics/*.jpeg
> I get images correctly tarred, but nested inside folders corresponding
> to the path.
> How do i get just the images directly inside images.tar without the
> directory structure?
Here is a little script that will do that for you:
#!/bin/bash
tarfile=/home/test/campics/images.tar
directory=/home/test/campics/
regex=*.jpeg
cd $directory
for file in `ls $regex`
do
tar rf $tarfile $file
done
Tom.
More information about the Wolves
mailing list