|
|
#1 |
|
Prospect
Join Date: Jun 2004
Posts: 1
|
Copying all files of a type to a folder
Howdy.
I know there must be a way to do this, but I am unsure how. iTunes has messed up my mp3 collection, duplicating many files. For example, in the library there are "Song", "Song 1", "Song 2", etc, that are all copies. I don't really know why this occured, but it has eaten up much of my free hard drive space. Thus, I would like to take every .mp3 file on my Mac and put them in one folder. Then I would manually delete the dupes, giving me my normal collection back and freeing up space. Trying to do the copy in the GUI is too much for my little G4 to handle, as with duplicates it's something like 4000 files. My question: How would I move all the .mp3 files on all disks to one folder using Terminal? Probably mv something, but I really don't know Unix much. Thanks for the help. |
|
|
|
|
|
#2 |
|
All Star
Join Date: Oct 2003
Location: The Netherlands
Posts: 741
|
What you can do is use the 'find' feature of the Finder and search for all mp3s on your computer.
Once found, you drag all the files you wish to a new folder. The Finder will then move your mp3s to this new folder. I have also a G4 and it copes well with almost 1000 mp3s.
__________________
..::|| Mac-addict since 1991 ||::.. |
|
|
|
|
|
#3 |
|
League Commissioner
Join Date: Sep 2003
Location: Tokyo
Posts: 6,057
|
For deleting the duplicates, a brief web search produced this nifty script:
Code:
#!/bin/bash OUTF=rem-duplicates.sh echo "#! /bin/sh" > $OUTF find -type f | while read x do md5sum "$x" done | sort --key=1,32 | uniq -w 32 -d --all-repeated=separate | sed -e "s/^/#rm \"/g" -e 's/$/\"/g' >> $OUTF chmod a+x $OUTF ls -l $OUTF |
|
|
|
|
|
#4 |
|
Prospect
Join Date: Jun 2004
Posts: 7
|
if you just want to move all your mp3s to a folder, you could try the following:
mkdir /mp3folder; find / -name '*.mp3' | xargs -i mv \{\} /mp3folder (I should mention that I'm still on jaguar, and my xargs command doesn't have the -i option, I hope they've added it for panther...). |
|
|
|
|
|
#5 | |||||||||||||||||||||||
|
League Commissioner
Join Date: Jan 2002
Posts: 5,536
|
this could be destructive. for example, finding these results: Art Blakey Quintet/A Night At Birdland/A Night In Tunisia.mp3 Lee Morgan/The Best Of Lee Morgan/A Night In Tunisia.mp3 the mv command would destroy Art Blakey's version. |
|||||||||||||||||||||||
|
|
|
|
|
#6 | |||||||||||||||||||||||
|
Prospect
Join Date: Jun 2004
Posts: 7
|
Good point. That didn't occur to me, as I have mv aliased to 'mv -i' for safety. I still can't think of an easy way to get all the duplicates renamed and moved into the same directory though. |
|||||||||||||||||||||||
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|