once more
The Penguin comes to aid the Windows (how nice of tux).
General approach:
# become root su - root # phase1) testing: list all files that match find /search/this/folder -iname "for*this*file*txt" -type f|less # phase2) delete: all the previously found files find /search/this/folder -iname "for*this*file*txt" -type f -delete
example:
Delete OSX Finder Files ._
# phase1): testing find / -iname "._*" -type f | less find / -iname "__MACOSX" -type f | less # phase2): delete find / -iname "._*" -type f -delete; find / -iname "__MACOSX" -type f -delete;
delete all Windows .DS_Store files
# phase1) testing: find / -iname ".DS_Store" -type f | less # phase2) delete find / -iname ".DS_Store" -type f -delete
delete all Thumbs.db and Thumbs.db:encryptable
# phase1): testing find / -iname "Thumbs.db" -type f | less find / -iname "Thumbs.db:encryptable" -type f; # phase2): delete find / -iname "Thumbs.db" -type f -delete | less find / -iname "Thumbs.db:encryptable" -type f -delete;
delete files older than x days with subdirectories
type option for filtering results
find accepts the type option for selecting, for example, only files.
# delete only files find /search/this/folder -type f -ctime +30 -exec rm -Rf {} \; # delete files and directories find /basedirectory -ctime +30 -exec rm -Rf {} \; # qnap find does not know ctime and exec use mtime and a temp file find /search/this/folder -type f -mtime +30 > /search/this/folder/files_to_delete.txt;
liked this article?
- only together we can create a truly free world
- plz support dwaves to keep it up & running!
- (yes the info on the internet is (mostly) free but beer is still not free (still have to work on that))
- really really hate advertisement
- contribute: whenever a solution was found, blog about it for others to find!
- talk about, recommend & link to this blog and articles
- thanks to all who contribute!