-   Programming (
-   -   File Dates (

Rv5 09-06-2004 04:15 PM

File Dates
What would the best way to be to get the file dates of files in the current directory through script? I want to archive all files older then say 30 days, and im not sure the best way to do it. any suggestions?

Cedrik 09-06-2004 06:01 PM

There are many way


find $PWD -mtime 30
That will display all files in current directory recursivlly that have been modified one month ago (and before)

Rv5 09-06-2004 08:09 PM

yeah i had ideas like that, but how do i get at each file, to move it say into my backup directory?

Rv5 09-06-2004 08:33 PM

could i use find and tar in conjuction say to archive all files 30 days or older?

something like

tar cv find -mtime 30

or something similar?

itsme86 09-06-2004 08:39 PM

Try: tar cfv archive.tar `find -mtime 30`

servnov 09-07-2004 05:59 PM

update the time with 'touch' see time with 'ls -l'

All times are GMT -5. The time now is 08:41 PM.