Skip to main content

Thread: How to recursively delete all files except certain types?


hello,
know may have been posted many times, i'm little bit lost bash , appreciated. have thousands of files in /music directory , subdirectories. how can recursively delete isn't , mp3 or flac file? i'd rid of isn't , mp3 or flac file
thank much!

dani

hi

use find.

code:
find . -type f  \( -not -iname "*.mp3" -not -iname "*.flac" \) -exec rm {} \;
test first though using echo.

code:
find . -type f  \( -not -iname "*.mp3" -not -iname "*.flac" \) -exec echo {} \;
kind regards


Forum The Ubuntu Forum Community Ubuntu Official Flavours Support General Help How to recursively delete all files except certain types?


Ubuntu

Comments

Popular posts from this blog

Some mp4 files not displaying correctly (CS6)

Thread: Samba is not authenticating with LDAP