LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   script to search new files in subdirectories (https://www.linuxquestions.org/questions/linux-newbie-8/script-to-search-new-files-in-subdirectories-4175433177/)

kumarjohn 10-20-2012 01:55 AM

script to search new files in subdirectories
 
Hi,

Greetings!!

I am newbie and started writing scripts few months back. I want to write a script to find the files and directories which were newly added to the existing directory structure.

My present directory structure is

dir1 has dir2,dir3,dir4 subdirectories and in ../dir1/dir2/ i have some more sub directories dir2.1 dir2.2

now I want the list files newly add anywhere in the directory structure.

Wishes,
KJ

sycamorex 10-20-2012 03:07 AM

Hi and welcome to LQ.

What do you mean "new"? New relative to what? You can easily identify files created/modified in the last N minutes using the find command (see find manual page to see all its flags, eg: -mtime or -mmin). Alternatively google search will return a lot of results.

HTH

David the H. 10-20-2012 01:13 PM

As above. In addition if you wanted to compare the current contents to some previous point in time, you'd probably have to store the names and date in a log file of some kind to compare against.

kumarjohn 12-21-2012 09:10 PM

Hi,

Greetings!!

Thanks sycamorex and David the H for the suggestion.

I have solved the issue using find command with -mtime option.

Best Regards,
KJ.


All times are GMT -5. The time now is 03:29 AM.