Reputation: 1
I was wondering if someone could help me edit an answer to the previous question:
.bat file sorting files into folders
I want to do something similar to that code. I want to sort files into folders using a section of the name, except rather than using the last 10 characters I want to use the 10th to the 20th character of the name. Thanks for any help!
SETLOCAL ENABLEDELAYEDEXPANSION
for %%a in (*.jpg) do (
set f=%%a
set g=!f:~0,10!
md "!g!" 2>nul
move "%%a" "!g!"
)
Upvotes: 0
Views: 305
Reputation: 56180
set g=!f:~0,10!
takes a substring, starting from the first one (starts counting at 0
!), with the length of 10.
If you want to start with the tenth char, keeping the lenght of ten, use
set g=!f:~9,10!
See set /?
for more information.
Upvotes: 2