Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 07-15-2009, 12:16 AM   #1
Registered: Jun 2009
Posts: 111

Rep: Reputation: 17
Remove Folders Recursively that contain *.mp3 files size 0KB or jpeg only.

Something happened with all my music and now I have zero bytes folders or empty folders with only jpeg. Is there a command that:

1) Find recursively folders (folders inside a folder) with *.mp3 0KB
2) Find folders inside folders with only jpgs
3) Remove those folders until it get to a parent directory.

I will greatly appreciate it.

Old 07-15-2009, 01:37 AM   #2
Senior Member
Registered: Jun 2006
Location: Hyderabad, India
Distribution: Fedora
Posts: 1,189

Rep: Reputation: 49
the find command should be able to do that.

find /mymp3s -name "*.mp3" -size 0c -exec rm -rf {} \;

man find, should get you details.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
find -exec command to recursively delete files and folders in folders with X name Joan Murt Linux - Newbie 2 07-08-2009 05:35 PM
Entering folders recursively to run script on files nested inside, ubuntu 7.10 aidansmoker Linux - Newbie 4 11-12-2007 12:39 AM
remove ~ from all files and folders BoraX Linux - General 1 10-25-2006 08:58 PM
How to unzip files recursively inside folders? jessdog9001 Linux - Software 2 03-22-2006 01:59 PM
Remove files w/ extension txt recursively spiri Linux - General 4 12-14-2005 04:52 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:14 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration