Finding new files (create after a time stamp)

Finding new files (create after a time stamp)

Post by eya.. » Wed, 22 Jul 1998 04:00:00




> Hello,
> What is the best way (using ksh or perl) to find all files in a directory
> created after a timedate stamp (such as 07/20/98:10:10)?  I was hoping this
> would be simple, but I keep coming up with very messy solutions.
> Thanks for any suggestions.
>      - Dan

find . -type f -newer XXX -print
Wher XXX is a file created which touch.
Which touch you can modify exactly the timestamp of the file.
man touch

Tschau

Erkan

 
 
 

Finding new files (create after a time stamp)

Post by jim babbingto » Wed, 22 Jul 1998 04:00:00




: What is the best way (using ksh or perl) to find all files in a directory
: created after a timedate stamp (such as 07/20/98:10:10)?  I was hoping
this
: would be simple, but I keep coming up with very messy solutions.

Using perl, you can use the -M test to determine the age of the file:

foreach (<*>) {
        $age = -M $_;
        print $_, " is ", $age, " days old\n";

Quote:}

Then  subtract that from the current date to get its create date.
--
I hope this helps,
Jim

 
 
 

Finding new files (create after a time stamp)

Post by Jeffrey Dru » Wed, 22 Jul 1998 04:00:00


[posted and mailed]


>Hello,

>What is the best way (using ksh or perl) to find all files in a directory
>created after a timedate stamp (such as 07/20/98:10:10)?  I was hoping this
>would be simple, but I keep coming up with very messy solutions.

>Thanks for any suggestions.

One thing to keep in mind with all of the other answers posted here is that
Unix doesn't keep track of the "creation time" of a file. The times
maintained are:

 mtime - time of the last modification to file
 ctime - time of last modification to inode (size, permissions, links)
 atime - time of last access to file

Given the above, the File::Find module can be quite useful if you need to
search an entire directory tree, as it provides virtually all of the
functionality of the Unix 'find' command from within Perl. If your needs
are less comprehensive (for example, needing only to check the contents of
a single directory), readdir and the unary file test operators (-M, -C and
-A for the times listed above) are probably the way to go.

'perldoc perlfunc' for implementation details.

--
                           Jeffrey R. Drumm, Systems Integration Specialist
                                  Maine Medical Center Information Services
                                     420 Cumberland Ave, Portland, ME 04101

"Broken? Hell no! Uniquely implemented." -me

 
 
 

Finding new files (create after a time stamp)

Post by Nitin G. Mule » Thu, 23 Jul 1998 04:00:00


: Hello,
:
: What is the best way (using ksh or perl) to find all files in a directory
: created after a timedate stamp (such as 07/20/98:10:10)?  I was hoping this
: would be simple, but I keep coming up with very messy solutions.
:
: Thanks for any suggestions.
:
:      - Dan

See if this helps you. The time stamp for touch should be in mmddhhmmyy
format.

touch 0722171598 /tmp/tmp.$$
find . -newer /tmp/tmp.$$ -print
rm /tmp/tmp.$$

--
'''''''''''''''''''''''''''''''''''''''''''''''''

 Wilfrid Laurier University, Waterloo, ON, Canada
"````````R U still looking for a quote?`````````"

 
 
 

1. Time discrepancy between Linux and DOS time stamps for same file

When I look at the time stamp on a dos file using ls in Linux, it reports
a different time than DOS reports for the same file using dir.

This is for the /dosc partition mounted under Linux as a type msdos partition.

The time differential seems to be about 10 1/2 hours; where Linux thinks the
file is 10 1/2 hours older than the DOS time.

Does anyone know a fix or reason for this?

Thanks,


--

2. Logical Volume Manager

3. How to find time that a file was created

4. Newbie USB question

5. How to find the file create date/time

6. get output of command?

7. how to find the time a file was created?

8. bugs in OpenGL 1.0

9. ? files created with date stamp of JAN 20 2001

10. File Time Stamp

11. Changing File Modified Time/Date Stamp

12. File Mode and Time Stamp

13. How to obtain the age of a file (epoch time stamp)