473,405 Members | 2,310 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

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:
Expand|Select|Wrap|Line Numbers
  1.  
  2. #!/usr/bin/perl
  3. use File::stat;
  4. use Time::localtime;
  5.  
  6. my @a = glob "*" ;
  7. foreach (@a) {
  8.  
  9.     if ( -e $_)
  10.     {
  11.         my $d = ctime(stat($_)->mtime);
  12.         print "FILE:  $_  \n DATE UPDATED:  $d.\n";
  13.     }
  14.     else
  15.     {
  16.             print "No file found $_.\n";
  17.     }
  18. }
  19.  
It display like this:

Expand|Select|Wrap|Line Numbers
  1. Code:
  2.  
  3. FILE:  mrm
  4.  DATE UPDATED:  Fri Jul 23 21:35:03 2010.
  5. FILE:  mysql
  6.  DATE UPDATED:  Fri Jul 23 21:37:08 2010.
  7.  
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).

Expand|Select|Wrap|Line Numbers
  1. FILE:  mysql
  2.   REMARKS:  No Backup on Thu Jul 22 2010.
  3.             No Backup on Fri Jul 23 2010.
  4.  
Your help is very much appreciated. Thank you so much.
Jul 26 '10 #1
2 1529
Oralloy
988 Expert 512MB
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.
Jul 26 '10 #2
@Oralloy
thanks sir
Jul 27 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Daniel | last post by:
when writing out a file from .net, when is the file created? after the bytes are all written to the hard drive or before the bytes are written to the hard drive?
4
by: wil | last post by:
Dear All, In the linux platform, is there anyway I can in a C program change the file create date? Thanks, wil.
1
by: Mei Qin | last post by:
Hello, I created a csv file on the server. I want to display it in the browser and user can download the file to local machine. Then I will delete the file from the server. Here is my code:...
4
by: Mike Kim | last post by:
Hi all, In VB6, you can display multiple forms together at design time. how do you do that in vs.net? as a default, vs.net has a group of tabs and only allow to see one at a time unless you add...
1
by: Jason | last post by:
Given a scenario where I'm monitoring a folder, once the file has been created, I'd like to have it relocated to another folder via the File.Copy() method. My problem occurs when I paste a...
1
by: Jeroen | last post by:
Hello, Is it possible to retrieve the date when a record is created in an Access database table? And if so, how can I do that (by code)? Thanks in advance, Jeroen Elias
9
by: loudking | last post by:
Dear all, I am writing a client-server application and the client should upload a file to the server, then the server should display the content of the file in stdout. Because I have to deal...
0
by: chongming | last post by:
Hi, i want to display all the filenames on browser. However i found that if there are many filenames in that folder, result will be it will display a long list of filenames on that browser. My...
0
vinci
by: vinci | last post by:
hi! is there any way to display Excel File to HTML? Excel file is formatted, so when displayed to a web the format is the same with the original file... uhm,,, if someone is thinking of...
1
by: Enij | last post by:
Hi All, I'm using VB.net 2003 Standard Edition, and I'm trying to retrieve the file modified date. Sounds painfully simple. Yup. But ... I cannot, for the life of me, figure it out. After...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.