Pages

Monday, September 9, 2013

Linux - find file in specific directory

If you want to search for all files under a specific directory and remove them, you could use the following command:

find . -type f -wholename '*/DIRECTORY/*' -exec rm -rf {} \;

Where DIRECTORY is the name of your directory.

For example, you will be able to find all theses files


/home/toto/test/DIRECTORY/toto.txt
/home/toto/test1/DIRECTORY/tata.txt
/home/toto/test2/DIRECTORY/titi.txt

You must execute the command from /home/toto

No comments:

Post a Comment