Created
February 15, 2014 22:45
-
-
Save carlynorama/9026262 to your computer and use it in GitHub Desktop.
Finding files that are too new (less than a year old) and removing them.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# (find) in this directory (.) items of (-type) file (f) whose last modification (-mtime) was less than 365 days ago (-365) | |
# pipe the result into a file called newfiles.txt | |
find . -type f -mtime -365 > newfiles.txt | |
#look at newfiles.txt | |
cat newfiles.txt | |
#if everything listed is a malicious file | |
#run the find again, but instead of outputing to file | |
#run as a subprocess (-exec) the remove command (rm) on each result ({}) | |
#terminate the exec called subrocess (\; , where the \ escapes the required ;) | |
find . -type f -mtime -365 -exec rm {} \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment