We help IT Professionals succeed at work.

finding newly created files

hptdyber asked
I can use the -atime to find files by the number of days, but I want to know how to find files that have been  created or (modified) in the last 1 hour or 2hours etc..
Could you give me some samples so that I will use the correct syntax?
Watch Question

Hi hptdyber,

     Here's what you can do for this.

     1. create a dummy file use touch (specify whatever acces/modify
        time you want. eg . we want the file time stamp on Sep 21, 9:20am

               touch -t 09210920 dummy

     2. find the files newer than dummy, use  find:

               find / -newer dummy -print

     this will give all the files on your system newer than dummy if you are
     root. (have permission to read the whole system). if you only worry          about  what's under you home dir, you can cd to your home dir, than      use:

                 find . -newer dummy -print

     to get result.

     If  you want to write a script to do this thing, you need to use date
     command to find out your current time, and use cut or awk to make         up the arg for the touch command.

     You can redirect the find command to a file for future reference.

     Please use man to find out the usage of the about commands




This is perfect for what I need to do.
Thank you so much,

Explore More ContentExplore courses, solutions, and other research materials related to this topic.