taint has asked for the wisdom of the Perl Monks concerning the following question:
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:
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:
Never mind the example above, it doesn't work, it returns:# delete $file if it's not been modified for 15 minutes if ( (stat $file)[9] < time() - (3600 / 5) ) { unlink $file; }
Would anyone be willing to provide an example, please?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.
Thank you for all your consideration
--chris
#!/usr/bin/perl -Tw use perl::always; my $perl_version = "5.12.4"; print $perl_version;
Back to
Seekers of Perl Wisdom