[ubuntu-uk] How to delete all .m4a files from music library

Mac Ammonius.Grammaticus at googlemail.com
Tue Oct 16 23:44:06 BST 2007


Matthew Wild wrote:
> On 10/16/07, Mac <Ammonius.Grammaticus at googlemail.com> wrote:
>>
>>  (It would be nice
>> to delete any directories that have become empty because they only had
>> .m4a files in them - but that would be a bonus!)
> 
> 
> Going for the bonus!
> 
> find ~/music/ -depth -type d -empty -exec rmdir {} \;
> 
> Matthew
> 
>  PS. can anyone see why this does not work to do it all in one (ignoring the
> rm)?:
> find test/ -depth \( -type f -name '*.m4a' \) -o \( -type d -empty \) -exec
> rm {} \;
>>From what I understand in man find, the brackets are not even needed, since
> the default operator is AND. However this line does not print any matches
> for me, unless I remove the directory part.
> 
> 


Matthew >>> Thanks for the thought you put into this.  In fact I'd 
already done the deletions manually, as there turned out to be few empty 
directories.  But your solution, and question, look interesting - even 
though I don't yet understand how they do what they do.

Many thanks for your time and interest.

Mac





More information about the ubuntu-uk mailing list