HOw will I display the missing file together the date when it was not created?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ellechim03
    New Member
    • Jul 2010
    • 2

    #1

    HOw will I display the missing file together the date when it was not created?

    Hello. Below is a perl script wherein it has to display date when was the last update/change on the directory.


    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";
        }
    }
    It display like this:

    Code:
    Code:
    
    FILE:  mrm
     DATE UPDATED:  Fri Jul 23 21:35:03 2010.
    FILE:  mysql
     DATE UPDATED:  Fri Jul 23 21:37:08 2010.
    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).

    Code:
    FILE:  mysql
      REMARKS:  No Backup on Thu Jul 22 2010.
                No Backup on Fri Jul 23 2010.
    Your help is very much appreciated. Thank you so much.
  • Oralloy
    Recognized Expert Contributor
    • Jun 2010
    • 988

    #2
    Not to sound trite, but you have to design your algorithm and implement it..

    Start by thinking about your requirements.

    Determine how to extract the date from the existing files' names.

    Then ask how you know which dates are missing.

    Finally, write the result.

    Comment

    • ellechim03
      New Member
      • Jul 2010
      • 2

      #3
      Originally posted by Oralloy
      Not to sound trite, but you have to design your algorithm and implement it..

      Start by thinking about your requirements.

      Determine how to extract the date from the existing files' names.

      Then ask how you know which dates are missing.

      Finally, write the result.
      thanks sir

      Comment

      Working...