Beefy Boxes and Bandwidth Generously Provided by pair Networks
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??


in reply to Deleting folders based on name.

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...

my @dates = ( '1010', '1007'); foreach my $date (@dates) { my ($year,$mon) = $date =~ m/\d\d/g; print "year = $year month= $mon\n"; }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://865969]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (5)
As of 2024-03-29 10:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found