Deleting files with the same name

Recently I replaced my old QNAP nas with a HP ProLiant MicroServer N54L. I then wanted to move everything I had from the QNAP nas to my new HP server, and it all went well, except for a lot of trash files I wanted to get rid of.

One of the problems was quite a lot of folders named “[email protected]__thumb” which were in almost all folders that had one or more pictures in, or at one point had a picture in. Inside that folder I had expected there to be some kind of thumbnail, but there wasn’t, so not sure what that is all about. But anyways, I wanted to get rid of them, and being too lazy to do it one by one, I did a bit of searching, and ended up with this line.

find . -name [email protected]__thumb -exec echo {} \;

This line does not remove anything, it just prints out everything it found. To delete actually remove the folders, this line is needed.

find . -name [email protected]__thumb -exec rm -rf '{}' \;

But it is a good idea to use the echo first, and go over the list of entries it is going to remove, before blindly executing the one that will remove everything it found.

Next problem was all the “Thumbs.db” files from windows, after having accessed the folders too. The same commands could be used once again…

find . -name Thumbs.db -exec echo {} \;

find . -name Thumbs.db -exec rm -rf '{}' \;
One Comment

Add a Comment

Your email address will not be published. Required fields are marked *