Page 1 of 1

Move Foldercontent in parent folder

Posted: 22 Jan 2010 12:38
by games1024
Hey guys, I have the following problem:
I need to put audio files (mp3s) from the subfolder in current.
Because I sync my psp with wmp and he automatically puts files in the folders like that \music\%interpret%\%album%\.
PSP can read music files with only one subfolder (\music\...\).
So I need to have a script putting foldercontent in the music folder without any subfolders.
I was thinking about a script like that:

Code: Select all

xcopy \*(//interpret)\*(//album)\*(//trackname).mp3 \(//folder of the script)*.mp3

But I dont know the syntax of "random folder".

Please help!!

--gameaIOZ4--

Re: Move Foldercontent in parent folder

Posted: 22 Jan 2010 18:23
by aGerman
You can't use wildcards. But using DIR /S into a FOR /F loop will help surely. Figure out.

Code: Select all

@echo off
for /f "delims=" %%a in ('dir /a-d /b /s *.mp3') do copy "%%a" "%%~nxa"

You have to create the batch in "music".
But note, ampersands in file names or folder names will cause a faulty execution.