Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

tar files between 2 dates

Status
Not open for further replies.

martinjust

Technical User
Apr 5, 2007
1
US
Hi. Newbie linux user here.

I need to create a tar file containing a number of files from another directory where the file dates fall between two dates.

I get recent files like this:

tar -c -v --newer-mtime="2007-03-01" -f mytarfile.tar /archive/logs/testlogs/*testlog

But now I need to set a high limit also.

thanks for any help!
 
This example would tar up all files from midnight on 1st January to midnight on 1st April:

Code:
touch 01010000 /tmp/startdate
touch 04010000 /tmp/enddate
find /archive/logs/testlogs -name "*testlog" -newer startdate -a ! -newer enddate > /tmp/filelist
tar -cvfT mytarfile.tar /tmp/filelist

Annihilannic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top