[prog] [Bash] script question

Terri Oda terri at zone12.com
Sun Sep 29 15:46:54 EST 2002


> for file in $maildir

As others have mentioned, this should probably be something along the lines
of 'for file in $maildir/*'

> do
>   mv $file $file-$datestamp
>   touch $file
> done

The only other thing I see, offhand, is that if you keep moving these files
like this, you'll end up with filenames like
	mail-Aug-2002-Sep-2002-Oct-2002
after you've run this in consecutive months.

How you avoid this is personal choice, but I'd probably make an archive
directory and do something like this:

archivedir=$maildir/Archived

for file in $maildir/*
	mv $file $archivedir/$file-$datestamp
	touch $file
done

With the appropriate change to the tar command.

 Terri



More information about the Programming mailing list