Just another Perl shrine | |
PerlMonks |
Re^4: removing files with perl based on age and nameby graff (Chancellor) |
on Jul 18, 2014 at 23:20 UTC ( [id://1094273]=note: print w/replies, xml ) | Need Help?? |
The "stat" function is implemented in Perl as a direct Plus, /usr/bin/stat tends to be one of those "core utilities" that don't actually have equivalent command-line syntax from one unix/linux OS to the next. (update: it might be /usr/local/bin/stat, or as pointed out above, it might not be found at all on some systems) To clarify the run-time issue... Just for grins I found a directory on my mac laptop (2.2GHz intel core i7, osx 10.8.5, perl 5.12) that happens to contain 12.6K files, and I tried two different scripts: I did it a few times, in both orders (j1 right after j2 and vice-versa), and the results were consistent. Imagine what the difference would be over a whole disk with, say, a million files. As for the cross-platform portability issue… I have to ask: which OS / version of stat are you using? The version of /usr/bin/stat I have on my mac doesn't support the particular command-line syntax you used, so even if I wanted to run your script, I couldn't. UPDATE: Oh, I forgot to mention… Have you tried running your script in a directory where file names contain spaces, and/or parens, and/or apostrophes, and/or ampersands, and/or … (I hope you get the idea).
In Section
Seekers of Perl Wisdom
|
|