Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re: Deleting folders based on name.by Marshall (Canon) |
on Oct 18, 2010 at 15:39 UTC ( [id://865969]=note: print w/replies, xml ) | Need Help?? |
Why don't you just concatenate "$hifolder/$lowfolder"? That is unique and gives you the absolute path that you would wind up using to delete the directory anyway. You probably need to prepend $hipath to the $highfolder name perhaps in the loop that iterates over the $highfolders". my @FullDirPaths = map{"$hipath/$highfolder/$_"}@LowFolders; You might want to look at Date::Time module for comparing dates. Or you could make a little YYYYMM "date math" routine yourself, but I suspect that using the module will be easier. Don't know if this is a typo or not, but don't put a ";" after the "->" ie have "->new();" Update: Don't know where my brain is this morning...Actually I don't think that you need to save the @FullDirPaths like above at all. At this point in the code you have all 3 parts of the full path: "$hipath/$highfolder/$lowfolder". Just decide right there whether or not you should delete this particular $lowfolder or not! No need to save the names to process later. You can use a simple regex to separate out the month and year from the filename like shown below...
In Section
Seekers of Perl Wisdom
|
|