Easy Windows directory flattening with minimal tools?
May 9, 2007 7:15 PM
Subscribe
I have a bunch of files, in a nested directory structure. I'd like to collapse the directory structure and move all the files into one folder, preferably sorting them by file extension or name. How do I do this as quickly and easily as possible in WinXP? (Using Cygwin is OK if that's the only way to do it.)
So, I have a bunch of music stored in the typical [Artistname]/[Albumname] hierarchy. It's a mix of formats. Some MP3, some WMA, some MP4 ... it's just generally a mess.
I want to sort it out. Basically, I want to pull ALL the music out of the nested folders and dump it in some other folder. Ideally I'd like to move all the files of a certain type into their own folder, so WMA files go in one folder, MP3s go into another, etc.
What's the easiest way to do this in Windows? Preferably without adding any additional software, although I'm OK with small freeware utilities or GPL tools like Cygwin (which I've been meaning to install anyway), although I keep thinking there has to be an easier way to do it than installing Cygwin and writing a shell script, which is the only solution I've come up with.
posted by Kadin2048 to computers & internet (7 comments total)
6 users marked this as a favorite
cd where_your_music_is
mkdir MP3
mkdir WMV
mv `find . -type f | grep -i mp3$` MP3
mv `find . -type f | grep -i mp3$` WMV
This will just put everything in a single dir:
mkdir STUFF
mv `find . -type f` STUFF
You might want to check that you have no duplicate filenames beforehand:
find . -type f | sed 's/.*\///' | sort | uniq -d
will print occurrences of duplicates.
posted by ldenneau at 7:29 PM on May 9, 2007