good chemistry is complicated,
and a little bit messy -LW
Deleting folders based on name.by fazedandconfused (Novice)
|on Oct 18, 2010 at 15:25 UTC||Need Help??|
fazedandconfused has asked for the
wisdom of the Perl Monks concerning the following question:
I'm fairly new to perl and have a requirement to create a script but I'm struggling a bit.
I have a directory on a Windows server which has 2 levels of subfolders below it. I want to read in the first list of subfolders and then for each of those read in the next level down. Once I have these (they are named MMYY) I want to work out any that are over 3 months old but based on the folder name and not any modification date then delete the older ones.
I've got this piece of code that should get me the first subfolder level,
then I have the following that should get me the next level down,
What I'm wondering is how I would go about making the @Lowfolders array uniquely named for each $Highfolder.
I also will need to convert the MMYY Lowfolder name to a Date at some point so that I can compare to the current date and work out which folders are more than 3 months old so that I can build my list of folders to delete.
Any help anyone can give me would be very much appreciated.