To find abc* in current directory
find . -iname abc*
To find abc* in /Downloads/ directory
find /Downloads/ -iname abc*
Find files (f) in current dir and then feed it to grep({}) to see if it contains text with 'abc', and consequently print it.
find . -type f -exec grep "abc" '{}'\; -print
or
find . -type f -print | xargs grep "abc"
Find and delete the files (BE CAREFUL)
find . -iname "abc" -delete
Delete empty directories
find . -empty -type d -delete
find files and mention the size of each,
find Desktop/prova/ -iname "*.pdf" -exec du -hs {} \;
Find multiple files and remove them
find ~/Desktop/Junk/ -type f −iname"∗.zip"−o−iname"∗.jpeg"−o−iname"∗.srt" -exec rm {} \;
count the files created in the last 1 min
find . -mmin -1 -type f -delete | wc -l
Delete all files created in the last 1 min
find . -mmin -1 -type f -delete
No comments:
Post a Comment