I have 1000 files with the suffix -PRO1
and -PPR2
(1000 each) so I have 1000 folders with the same names but without the suffix...
For example I have a folder called Abstract_Colorful
and I have the files Abstract_Colorful-PRO1
and Abstract_Colorful-PPR2
and so on...
I want to make a batch to be able to move all files automatically, I have this code (from another post)
@echo off
setlocal enabledelayedexpansion
pushd "C:\Folders\"
for %%a in (*) do (
set fldr=%%~na
set fldr=!fldr:~0,4!
md "!fldr!"
move "%%a" "!fldr!"
)
popd
pause
exit
but what it does is that if the file has more than 4 characters it creates a folder with the first 4 chars... What I want to do is that the batch recognizes the filename and stops at the -
and moves to the folder...
Thanks for your time :)