Open the terminal and go to the folder:
Find results and test if it yields your desired results:
find . -type f -name “*SpecificString*”
And if the find command results desired output, type in the following in the terminal to delete action:
find . -type f -name “*SpecificString*” -delete
Or a shorter version: find /path/to/your/files/ -type f -name “*SpecificString*” -delete
For home folder:
!!! first run a test
find ~ -type f -name “*SpecificString*”
and than
find ~ -type f -name “*SpecificString*” -delete
For the whole filesystem
!!! first run a test !!!
sudo find / -type f -name “*SpecificString*”
and test again and than delete with
sudo find / -type f -name “*SpecificString*” -delete
Or only in the specified directory:
find /path/to/your/files/ -maxdepth 1 -type f -name “*SpecificString*” -delete
How to list files based on matching only part of their filename?
Using find (this only includes files)
find -type f -name “Account*”
Using ls (this might include folder as well)
ls -1 Account*
Using ls and grep (grep, this could include folder as well)
ls -1 | grep -E “^Account”
Recursively Find & Move all files with a certain extension from multiple subdirectories into one directory
Find files:
find . -iname ‘*.mp4’
Syntax: find /source/folder/ -iname “*.FileExtension” [Current directory: . Case Insensitive: -iname]
find src/dir/ -name ‘*.txt’ -exec mv {} target/dir/ \;
Move files:
find . -iname ‘*.gif’ -exec mv {} “/path/to/single/target/directory/GIF” \;
More example usage of find command
Find Size between 50MB – 100MB
find / -size +50M -size -100M
Find all .mp3 files with more than 10MB and delete them
find / -type f -name *.mp3 -size +10M -exec rm {} \;
Find files larger than 10mb
find -size +10M
Find file with specific name (case unsensitive)
find -iname nameofthefile.txt
Find a specific file type
find -type f -name “*.zip”
Find and remove Multiple File
find . -type f -name “*.torrent” -exec rm -f {} \;
Find all Empty Directories
find /tmp -type d -empty
File all Hidden Files
find /tmp -type f -name “.*”
Find Last 50 Days Modified Files
find / -mtime 50
Find Last 50 Days Accessed Files
find / -atime 50
Find Last 50-100 Days Modified Files
find / -mtime +50 –mtime -100
Find Changed Files in Last 1 Hour
find / -cmin -60
Find Modified Files in Last 1 Hour
find / -mmin -60
Find Accessed Files in Last 1 Hour
find / -amin -60