To simplify routine work I made a batch script (.bat) that gives, for example, 4 subfolders and 16 *.dds files in the current folder.
These subfolders and files have ordered names like: Folder names: 002360, 002361, 002362, 002363. File names: file-0.dds, file-1.dds, file-2.dds, ... , file-15.dds.
I would like to extend this script to obtain the following:
a) It takes the first 4 files (from "file-0.dds" to "file-3.dds") moves them to the first folder ("002360") and renaming them to be from "003760.dds" to "003763.dds".
b) It takes the next 4 files (from "file-4.dds" to "file-7.dds") moves them to the next folder ("002361") and renaming them to the same names, namely from "003760.dds" to "003763.dds".
...
d) It takes the last 4 files (from "file-12.dds" to "file-15.dds") moves them to the last folder ("002363") and renaming them to the same names, namely from "003760.dds" to "003763.dds".
The number of moving files for each folder is same, I assign this number as variable:
%y%
The first file name (namely "003760.dds") can be entered at the beginning together with other variables.
Also I'm concerned with leading zeros in the file names. For the folders creating I use a loop like:
set /p n=Enter the number of the first zeroes in folder names:
set /p x_=Enter the name (without first zeroes) of the first folder:
set /a x=x_
set /p y_=Enter the number of folders:
set /a y=y_
set /a z=x+y-1
if %n%==2 (
for /l %%i in (%x%, 1, %z%) do md "00%%i"
) else if %n%==3 (for /l %%i in (%x%, 1, %z%) do md "000%%i"
)
I don't know how to make a loop to select the first few files and move them to the first folder. The renaming operation can be postponed, because it can be done after all files moving. Maybe there are some examples with the commands I need.