User Tools

Site Tools


Sidebar

Computer Science

Germany

Others

Links

computer_science:software:linux:commands:delete_all_files_with_the_same_name_pattern_in_a_directory_and_its_subdirectories

First use the command find to find all the files with a specific pattern. The -print0 options is useful for xargs. -print0 seperates each result of find with a 0 character.

Then pipe the content of find to xargs. Use the -0 option of xargs, if your paths contain spaces characters.

The following command remove all the files with the .db extensions in the current directory and its subdirectories.

find . -name *.db -print0 | xargs -0  rm -vf
computer_science/software/linux/commands/delete_all_files_with_the_same_name_pattern_in_a_directory_and_its_subdirectories.txt · Last modified: 2015/03/12 10:39 by thomas