Delete all *mp3 files without confirmation and inside all folders /sub

I am now in the "upload" folder (centos 7)

I want the files *mp3 which is inside this folder and the folders inside it
without being constantly "y" Hit

I use this code, but I have to go into each folder and run the code, which is time-consuming . I want all to be deleted automatically.

rm *.mp3
Asked By: amir salarr


You can use GNU find for this. If you are already in the target directory:

find . -name '*.mp3' -delete

That will find all files whose name ends with mp3 in this directory and all sub directories and delete them.

Answered By: terdon
Categories: Answers Tags:
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.