Hi Guys,
I am deleting 180 days old files from a directory. Now, I want the output that should count the number of files deleted. Here's my code:
if (chdir($storage_ABC_Dir))
{
foreach $FILES (<pabc*.*>)
{
if (-M "$storage_ABC_Dir/$FILES" > 180)
{
unlink("$storage_ABC_Dir/$FILES");
if ( $? != 0)
{
print "LOGIT_W. Can't cleanup files in $storage_ABC_Dir \n";
}
else
{
print "Total number of files deleted: \n";
}
How to achieve this please?
Any help is greatly appreciated.
Thanks in advance.
Sappleg
I am deleting 180 days old files from a directory. Now, I want the output that should count the number of files deleted. Here's my code:
if (chdir($storage_ABC_Dir))
{
foreach $FILES (<pabc*.*>)
{
if (-M "$storage_ABC_Dir/$FILES" > 180)
{
unlink("$storage_ABC_Dir/$FILES");
if ( $? != 0)
{
print "LOGIT_W. Can't cleanup files in $storage_ABC_Dir \n";
}
else
{
print "Total number of files deleted: \n";
}
How to achieve this please?
Any help is greatly appreciated.
Thanks in advance.
Sappleg