Need a shell command to show last modified files and create a .txt

subster

Elite Member
Joined
Apr 5, 2008
Messages
2,157
Reaction score
1,608
Hi there,

I'd need a shell command to show of the last modified and new files on the whole server (recursive) and echoing them into a txt file in the root.

Has anybody something like this?

Would be so awesome (Rep + Thanks will be given).
 
if you are using a Linux system you can use the following command:

Code:
find / - mmin 60  -printf "%AD %Ar - %p\n" 2> /dev/null | head -300 | sort -r > /lastmodified.txt

the parameter 60 will show the files modified on the last 60 minutes, you can modify it.
the parameter -300 will show only the first 300 results, you can also modify it. if you want all the results use only:

Code:
find / - mmin 60  -printf "%AD %Ar - %p\n" 2> /dev/null | sort -r > /lastmodified.txt

the results will be written on the file /lastmodified.txt

PS: you have to be root to write on /
if you are not root redirect the results to another file, for example /tmp/lastmodified.txt
 
Thank you so much!

Worked flawless!
 
Something was wrong - this has shown me everything from the server files, but not from the directories with the website files in.
 
still only folders like /var / proc/ and so on...
 
Now I got it:
Exchanged file / to file . and removed the "2> /dev/null"
 
Back
Top