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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with gtar

Status
Not open for further replies.

hogsac

MIS
Aug 26, 2002
18
US
I would like to tar up files in a certain directory. However, I would only like to tar up files with modification dates BEFORE 12/31/2002. I am aware of how to do this to only tar up files with modification times AFTER 12/31/2002, but I am not sure how to get everything before that particular date...
Any ideas??
 
man find says:
-----
Example 2: Removing files

Remove all files in your home directory named a.out or *.o
that have not been accessed for a week:

example% find $HOME \( -name a.out -o -name '*. \) -atime +7 -exec rm {} \;
-----

-> today is Jan 8 -> Dec 31 is 8 days ago
--> tar cf oldfiles.tar `find /somewhere -atime +8`

Regards
-- Franz
Sorry I'm not a native spaeker, I'm from Munich, Germany - "Home of the Whopper", oh no, "Home of the Oktoberfest" ;-)
 
Thanks...actually, I want files before 12/31/2002, so I will add 8 to 365 and use 373 as my number of days.
How does the operating system differentiate between modification time and access time?? I think in my case, I want to use modification time as an option. I interpret that as last time the file was edited or changed whereas I interpret access time as the last time the file was used or vi'd or something like that.
 
@hogsac

sorry, 2002, 2003, they are just number's... ;-)

Yes, you would want to take -mtime, since you want to archive Files beeing opened and modified not just accessed (cat, more)

Regards
-- Franz
Sorry I'm not a native spaeker, I'm from Munich, Germany - "Home of the Whopper", oh no, "Home of the Oktoberfest" ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top