1.

Solve : batch file to move files into new folder based on artists name only before -?

Answer»

Hi all, I tried to modify this code for my situation, and think it's ok, but i'd ALSO like to add something else. I have about 60k of mp3 and .cdg KARAOKE FILES in one folder with multiple artists, I am looking to run a batch file to move all files by a particular artist into a new folder with the artists name and add "greatest hits" to each new folder that gets created. All files have a - after artists name, so I assume this is the delimeter. (coding novice) - would really appreciate and advice or help is getting the code right for the batch file please.....thanks in advance.

Hope this makes sense... and one last thing, do i just remove the text echo to get rid of the PAUSES ?

echo off
setlocal enabledelayedexpansion
for %%A in (*.mp3 *.cdg) do (
   echo file found  %%A
   for /f "delims=" %%B in ("%%A") do set fname=%%~nB
   for /f "delims=" %%C in ("%%A") do set fextn=%%~xC
   for /f "tokens=1* delims=-" %%D in ("!fname!") do set folname=%%D
   echo folder name !folname!
   if not exist "!folname!" (
      echo Folder !folname! does not exist, creating
      MD "!folname!"
   ) else (
      echo Folder !folname! exists
   )
   echo Moving file %%A to folder !folname!
   move "%%A" "!folname!"
   )
echo Finished
pause



Discussion

No Comment Found