How can I delete every file on the system which have something
in the name?
-
1Possible duplicate of: askubuntu.com/questions/443830/…– TheWandererMay 18, 2015 at 12:52
1 Answer
Please be careful
This following command with the parameter -delete
deletes all the files with something
in the name in the specified directory and in all subdirectories.
Open a terminal and go to the right folder:
cd <your_search_starts_here>
test with
find . -type f -name "*something*"
and delete with
find . -type f -name "*something*" -delete
Or a shorter version:
find <your_search_starts_here> -type f -name "*something*" -delete
For your home folder:
!!! first run a test
find ~ -type f -name "*something*"
and than
find ~ -type f -name "*something*" -delete
For the whole filesystem
!!! first run a test !!!
sudo find / -type f -name "*something*"
and test again and than delete with
sudo find / -type f -name "*something*" -delete
Or only in the specified directory:
find <your_search_starts_here> -maxdepth 1 -type f -name "*something*" -delete
And because you have used the tag locate
:
The results of a search with locate
are based on a database. This may be outdated. Start an update with sudo updatedb
. find
performs a true search. However, it also takes longer.
-
That's the problem
right folder
.. those files are all across the system and it will be pain to navigate it to each folder and delete them.– GoroMay 18, 2015 at 12:26 -
As I wrote "This command deletes all the files with
something
in the name in the specified directory and in all subdirectories."– A.B.May 18, 2015 at 12:27 -
So there is no way to say
check the system, find "files" and delete them
without to say firstin this directory
as I said is too much time consuming if I navigate to each directory where it has the file and then delete it.– GoroMay 18, 2015 at 12:30 -
2
-
Thank's let me try it. It will be long long
find....
I will post the result.– GoroMay 18, 2015 at 12:36