Forum Moderators: coopster & phranque

Message Too Old, No Replies

shell script to copy files after a certain time

         

tienchihwang

9:54 pm on Mar 25, 2004 (gmt 0)

10+ Year Member



Hi,
I need to write a shell script to copy some files in one folder to another. The timestamp of these files should be within a certain period of time(For example: within one month before current date). Any good suggestions?

Thanks in advance

Tien-Chih Wang

tombola

12:49 pm on Mar 26, 2004 (gmt 0)

10+ Year Member



Welcome to Webmasterworld, tienchihwang!

You can change the date/timestamp ($date) of a file ($filename) with the touch command:

`touch -t $date $filename`;

You can subtract 2592000 (=60*60*24*30) from the actual date/timestamp to set the timestamp to 30 days before the current date.