Computer Hope
Microsoft => Microsoft Windows => Windows XP => Topic started by: winniethepujols on December 28, 2007, 11:17:21 AM
-
Basically, I'm looking for a way (through DOs, perhaps?) to move all files in subfolders to the root directory. Let me explain this by showing my setup:
Parent : Music (Root)
Level 1 Sub-Directory: Green Day
Level 2 Sub-Directory: Dookie
DO - Song 1.mp3
DO - Song 2.mp3
DO - Song 3.mp3
Level 2 Sub-Directory: American Idiot
AI - Song 4.mp3
AI - Song 5.mp3
AI - Song 3.mp3
Level 1 Sub-Directory: Blink 182
Level 2 Sub-Directory: Enema of the State
ES - Song 1.mp3
ES - Song 2.mp3
ES - Song 3.mp3
Level 2 Sub-Directory: Blink 182 - Greatest Hits
BGH - Song 4.mp3
BGH - Song 5.mp3
BGH - Song 3.mp3
What I want to do is move all of the MP3 files to the "Music" folder; in other words, I want to move all files in subdirectories up to a desired parent folder.
Anyone know of a way I can do this? I searched for utilities online but it's kind of a difficult thing to search for. I was also thinking there is possibly a way to do this through DOS.
Moving manually is not practical -- there are hundreds of folders.
-
This may work for you:
@echo off
for /f "tokens=* delims=" %%x in ('dir /s /b \music\*.mp3') do (
move "%%x" \music
)
I guessed that those prefixes (DO, AI, ES, and BGH) were part of the song name otherwise you'll have problems with duplicate song titles.
Good luck. 8)
-
It worked, thanks a million!