Hi,
In a Unix script (csh) I'm wanting to create an archive script.
For a certain directory I want to tar and zip all files over 31 days old.
The naming convention I want for my resulting file needs to be something along the lines of :
[earliest_file_date_includ
ed]_[lates
t_file_dat
e_archived
].tar.gz
I've sorted out how to do some of this, but need some help with the rest. For example, I'm using a bit of perl to get the date 31 days ago in YYYYMMDD format and using this to touch (-t) a file and then using a unix find (! -newer) to build a file list of all files I want to archive.
Is there a way to get the date/timestamp of the oldest file in the that list out in YYYYMMDD (or any!) format so that I can use it in my final file name?
As always, any help much appreciated!
Start Free Trial