I am getting some error when i am trying to run the following code ,
My requirement is to find the file with date-format Ex : I have files in a directory with names
01-02-2013.tar.gz
02-02-2013.tar.gz
.....
so now i am trying to find a file 01-02-2013
here is the code snippet
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time-6*24*60*60);
$year += 1900;
$mon += 1;
$mday = '0'.$mday if ($mday<10);
$mon = '0'.$mon if ($mon<10);
my $date_folder =~ /"$mday-$mon-$year"/;
if (-e $date_folder){
unlink $date_folder or die ("Cannot Delete $date_folder : $!");
}
here i am basically trying to find the file 6 days back(for example : 01-02-2013.tar.gz ) of current date , SomeWhere i feel like my $date_folder =~ /"$mday-$mon-$year"/; is going wrong ,
Any Suggestions ?