Hi all,
I need to create a script to delete some folders every month. I have a Folder that has sub folders named by company (These can change) and then under each of those are further sub folders called by MMYY values. Every month I want to run a script to delete folders older than 3 months, however I want to do this based on the folder name and not any created or modified time.
I've got this so far which should get me a list of the first level folders in the @Highfolders array and then the sub folders of each of this into the @Lowfolders_$hf array (I think).
my @HighFolders;
my $Highpath="D:/FSA/Recordings/";
use File::Util;
my($hf) = File::Util->new();
my(@HighFolders) = $hf->list_dir($Highpath,'--dirs-only');
foreach $hf(@Highfolders)
{
use File::Util;
my($lf) = File::Util->new();
my(@Lowfolders_$hf) = $lf->list_dir($lf,'--dirs-only');
}
I'm not sure how to do the date checking that I now need to do apart from just getting the current MM and YY figures then doing all the calculations necessary to work around year end. I'm sure there must be some simpler way of doing it so I am asking here to see if anyone can help.
Thanks.
I need to create a script to delete some folders every month. I have a Folder that has sub folders named by company (These can change) and then under each of those are further sub folders called by MMYY values. Every month I want to run a script to delete folders older than 3 months, however I want to do this based on the folder name and not any created or modified time.
I've got this so far which should get me a list of the first level folders in the @Highfolders array and then the sub folders of each of this into the @Lowfolders_$hf array (I think).
my @HighFolders;
my $Highpath="D:/FSA/Recordings/";
use File::Util;
my($hf) = File::Util->new();
my(@HighFolders) = $hf->list_dir($Highpath,'--dirs-only');
foreach $hf(@Highfolders)
{
use File::Util;
my($lf) = File::Util->new();
my(@Lowfolders_$hf) = $lf->list_dir($lf,'--dirs-only');
}
I'm not sure how to do the date checking that I now need to do apart from just getting the current MM and YY figures then doing all the calculations necessary to work around year end. I'm sure there must be some simpler way of doing it so I am asking here to see if anyone can help.
Thanks.