|I'm not sure the title is my exact problem, but i'm trying to run a batch file that moves files to the correct folder if it matches the folder name.|
The current batch works as is but i'm manually adding any new foldernames into the batch as required. I'd like this automated and can't figure out how to create a Folderlist variable that can be used in place of the "nameX".
I've tried using the same FOR command as used at the start but only the last foldername in the list is set as the variable. I can't figure out how to get it to process each line through the batch.
The LoCase adjusts the case of the variable so it can match the string in case there is mixed case in the filename.
for /f "tokens=* delims=" %%a in ('dir/b /od *.txt'') do (
CALL :LoCase String
IF %FolderName% == "name1" (set TAG=Name 1)
IF %FolderName% == "name2" (set TAG=Name 2)
IF %FolderName% == "name3" (set TAG=Name 3)
for /f "tokens=* delims=" %%a in ('dir/b /od *.txt') do (
move "J:\Folder\%FileName%" "J:\Folder\%TAG%"