Greetings everyone,
I've been struggling with an attempt to clobber symlinks in a folder, if they are older than
N minutes.
After much work with File::Find, I found that
I am unable to make it work. SO, I decided to look to perlfunc's -X
(-C in this case). which will return the Creation-time, which I can compare to Current-time. Allowing me to clobber anything older than 11 minutes from now.
Problem is, I'm not smart enough to figure out to how list the files Creation-time with perlfunc's -C.
Looking at
How do I delete... get's me close. But does mtime (modified) == ctime?
I could get close:
# delete $file if it's not been modified for 15 minutes
if ( (stat $file)[9] < time() - (3600 / 5) ) {
unlink $file;
}
Never mind the example above, it doesn't work, it returns:
Use of uninitialized value in numeric lt (<) at line 12 (#1)
(W uninitialized) An undefined value was used as if it were already
defined. It was interpreted as a "" or a 0, but maybe it was a mistak
+e.
To suppress this warning assign a defined value to your variables.
Would anyone be willing to provide an example, please?
Thank you for all your consideration
--chris
#!/usr/bin/perl -Tw
use perl::always;
my $perl_version = "5.12.4";
print $perl_version;
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.