Recursively delete all flac's in subdirectory, but leave the remaing alone

Hi,

Originally, I ripped my music with FLAC and used folder.jpg at various levels of the folder hierarchy. Now, after converting the FLACs to ALACs and embedding the artwork, I want to get rid of these old FLACs, but keep the folder hierarchy with the associated folder.jpgs inside (I have a lot of Artists .jpgs that I might want to use someday.

The high level folder is called "Old Music", and this is where I want the FLACs removed. I don't want to touch any other sibling folders for this command.

What Terminal command can I run to accomplish this task? I have a copy of my real ALAC files, but not these old FLACs. They're taking up too much room, so I need to delete them.

Thanks.

24" iMac 3.06 GHz Core 2 Duo/1 TB/8 GB; MBP 17" Core 2 Duo/Santa Rosa, Mac OS X (10.6.5), Parallels v6 with Win7 x64; iPod Touch 2G; iPhone 3GS (4.2.1); iPhone 4 (4.2.1)

Posted on Dec 14, 2010 6:45 AM

Reply
22 replies

Dec 14, 2010 2:48 PM in response to ScuseMe

Now this is strange. The Finder find for .flac has ended (no more spinning wheel), but the it still says "more than 10,000 found". I really want an exact number that I'm deleting (call me a stickler for details).

Why doesn't Finder show the exact amount of files found? Seems an easy thing to do.

Maybe a ls | grep would give me an exact count. Then when I go to delete, the numbers should match.

I don't like the words "more than...." in computer-ese. Could mean anything.

Dec 14, 2010 2:58 PM in response to ScuseMe

Your files are backed up, just good insurance, yes? maybe clone the entire drive and work on one or the other.

I'd take a look at a folder/synch utility like Tri-Backup 5 or something, can filter what you want to copy, and copy to a new location while skipping any 'widget' you don't want, as well as a list of what types and extensions should be included (*.a).

Possible that even in 2010 that someone would have coded for 9,999 counters.

And take a look at your folders through the eyes of Path Finder instead which has its own built in search/find.

Dec 14, 2010 3:12 PM in response to ScuseMe

So long as the files all have the same .flac extension and reside in the same parent folder, then use the Terminal:
rm -rf /pathto/parentfolder/*.flac


This should recursively remove all .flac files located in the parentfolder and an subfolders of the parentfolder. If there are any spaces in the path or foldername then enclose in quotes: "/pathto/parentfolder/*.flac"

Dec 14, 2010 4:25 PM in response to The hatter

This music in this folder is not backed up. I've converted each flac here to alac over a year ago. But my NAS is getting filled, so I need to delete these extraneous flacs. I would normally just delete the parent folder (Old Music), but I want to keep the folder.jpgs around just in case I need them again. Some of these I had to scan manually, since nothing existed on the web for my old CD's.

I have Path Finder, so I may try that too.

Thanks.

Dec 14, 2010 5:23 PM in response to ScuseMe

I finally got my job to work in an easily-understandable way using EasyFind by DEVONtechnologies. It found all the FLACs (18579), shows the paths so I didn't screw up the search, and allows me to wasily delete them.

Thanks to everyone's ideas, but the EasyFind way just seems more intuitive and straightforward than even Finder itself.

Dec 14, 2010 5:55 PM in response to Kappy

Ok Kappy, I tried your way, and I'm not having any luck. The path to the directory is:

//johndoe@READYNAS%20(CIFS). smb.tcp.local/media on /Volumes/media (smbfs, nodev, nosuid, mounted by johndoe)

It's a NAS on the network. The folder under /Volumes/media is called Old Music, and that's the one I want to recurse and delete all the flacs. But I can't get the command line to work.

imac:/ johndoe$ rm -ri "/Volumes/media/Old Music/*.flac"
rm: /Volumes/media/Old Music/*.flac: No such file or directory
imac:/ johndoe$

I put the -ri in there to force confirmation just to see what happens the first time. I'd planned to replace it with your -rf, but that point seems moot now. I think it has something to do with the network path name; it's always "not found", even though I can CD into it and do a ls:

imac:music johndoe$ cd "/volumes/media/old music"
imac:old music johndoe$ ls

10,000 Maniacs
10cc
Aaron Copland
Aaron Davis
Abra Moore
Acoustic Alchemy
Adam del Monte

<etc>


Any ideas?

Thanks.

Dec 15, 2010 10:22 AM in response to ScuseMe

How is the NAS formatted? I wonder if it is running under a different OS that you may not be able to access it even from the Terminal. This may be why you cannot delete the files using Easy Find. There may be a need to specify a path that conforms to the NAS' native format. I'm just grasping at straws here because working with networked drives is something with which I have no experience. I guess I was under the impression you were doing this on a local drive.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Recursively delete all flac's in subdirectory, but leave the remaing alone

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.