in reply to Delete Files
Your use of stat() is also unnecessary. You aren't capturing it's return value
To clarify the previous response:
if (-f $filepath) says "if $filepath is a file then do everything in the following block of code"
You probably want:
Which says "if $filepath is a file AND it's mod time is more than 3 days agao . . ."if (-f $filepath && (-M $filepath > $daysToPurge))
Can't say why it worked on the first machine. It shouldn't have.
And just a tidbit that you might find helpful. It has nothing to do with perl but applies to the art of SysAdmin.
Naming files as somefile-2003-Jan... isn't going to sort nicely when you do a DIR command or view the directory in explorer. That's because $somefile-2003-Feb.. will appear before the Jan file, etc. It's better to use numeric months for that reason. Perhaps I'm just anal. . .
|
|---|