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!

File Retention Script

Status
Not open for further replies.

bigbalbossa

Programmer
Mar 21, 2002
87
US
I would like to delete files from a remote server via ftp based on date. A 'dir' produces this listing:

-rwxrwx--- 1 proc C01998 42 Nov 23 12:12 HF_AVSVH_OP.ctl
-rwxrwx--- 1 proc C01998 40 Dec 12 10:37 HF_AVS_OP.ctl

Retention is 10 days, so the file HF_AVSVH_OP.ctl should be deleted (base on todays date of Dec 13). I was thinking about redirecting the 'dir' command to a file and parsing out the filename and date componets. But i'm not sure how to compare the dates.

Any other thoughts?
 
Try taking a look at the following functions built into Perl...

Code:
opendir
stat

They'll do what you want without having to rebuild what they're made for.

- George
 
Have you a listing with files from last year, this could really screw up around jan ;-)

Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top