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 |
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 |
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.
|
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. |