Hello. Below is a perl script wherein it has to display date when was the last update/change on the directory.
Code:
It display like this:
On the display, MRM and MYSQL our directories and it displays the date when it was last updated. Each directory have a file like this: mysql07232010-18:00.gz for mysql directory and mrm07232010-18:00.gz for MRM directory (the backup file). Every day it creates new file with almost the same file name, the only difference is that the number changes because it depends on the date when it was created.
My problem is how will I add on the script above where it will display the file and date when it has no backup.
Sample Output: (let say the directory does not update for two days (Jul 22 and 23).
Your help is very much appreciated. Thank you so much.
Code:
Code:
#!/usr/bin/perl
use File::stat;
use Time::localtime;
my @a = glob "*" ;
foreach (@a) {
if ( -e $_)
{
my $d = ctime(stat($_)->mtime);
print "FILE: $_ \n DATE UPDATED: $d.\n";
}
else
{
print "No file found $_.\n";
}
}
Code:
Code: FILE: mrm DATE UPDATED: Fri Jul 23 21:35:03 2010. FILE: mysql DATE UPDATED: Fri Jul 23 21:37:08 2010.
My problem is how will I add on the script above where it will display the file and date when it has no backup.
Sample Output: (let say the directory does not update for two days (Jul 22 and 23).
Code:
FILE: mysql
REMARKS: No Backup on Thu Jul 22 2010.
No Backup on Fri Jul 23 2010.
Comment