First, define what you mean by "60-day old directory." Do you mean the directory was created 60 days ago or the oldest file contained within it is 60 days old?
I believe that most O/S mark a directory as modified (change it's mod time) only if a file has been added or deleted (this includes moved), but not if a file has been changed, i.e., touching an existing file won't necessarily change the mod time on the including directory1.
The actual function you would is either rmdir or rmtree from the File::Path module. Unlink won't remove directories, unless "you are superuser and the -U flag is supplied to Perl." It also warns against using unlink to remove directories in all circumstances.
added in update1 …of course, these same comments apply to directories within the top level directory, and their sub-directories, and so forth. Recursion!
Information about American English usage here and here. Floating point issues? Please read this before posting. — emc
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.