Here is a batch file (referred to here as "x.bat") which has the links to the folders that you want to put the files in:
mkdir "FilesToHere\1"
mkdir "FilesToHere\1\Example 1"
mkdir "FilesToHere\1\2"
mkdir "FilesToHere\1\2\Example2"
mkdir "FilesToHere\1\2\Example2\3"
mkdir "FilesToHere\1\2\Example2\4"
mkdir "FilesToHere\1\2\Example2\3\Example3"
mkdir "FilesToHere\1\2\Example2\3\Example 1"
mkdir "FilesToHere\1\2\Example2\3\Example4"
mkdir "FilesToHere\1\2\Example2\3\Example4\5"
mkdir "FilesToHere\1\2\Example2\3\Example4\5\Example5"
mkdir "FilesToHere\1\2\Example2\3\Example4\5\Example5\6"
mkdir "FilesToHere\1\2\Example2\3\Example4\5\Example5\7"
mkdir "FilesToHere\1\2\Example2\3\Example4\5\Example5\7\Example 1"
mkdir "FilesToHere\1\2\Example2\3\Example4\5\Example5\7\Example6\1"
mkdir "FilesToHere\1\2\Example2\3\Example4\5\Example5\7\Example6\1\Example7"
mkdir "FilesToHere\1\2\Example2\3\Example4\5\Example5\7\Example7"
mkdir "FilesToHere\1\2\Example2\3\Example4\5\Example 1"
mkdir "FilesToHere\1\2\Example2\3\Example8"
mkdir "FilesToHere\1\Example9"
2000 files/20 folders = 100 files/folder. (You can changed the numbers in the following for your own files/folder preference. "[...]" indicates that, for example, 16 list items are missing in a list expressed as "1, 2, 3, [...] 20". Directory "s" has the 2,000 files. "FilesToHere" is located in "C:\user\Documents\ex1\ex 2\".) You can distributed the files in this way:
- Open "cmd.exe" and run
cd C:\user\Documents\FI\le\s
dir/b>../temp.txt
- Run "C:\user\Documents\FI\le\t.bat", which contains
cd C:\user\Documents\FI\le\s
powershell -command "& {Get-Content ../temp.txt -TotalCount 100}" > ../temp1.bat
gvim -c "execute \"normal! 100dd\"" -c "wq" ../temp.txt
powershell -command "& {Get-Content ../temp.txt -TotalCount 100}" > ../temp2.bat
gvim -c "execute \"normal! 100dd\"" -c "wq" ../temp.txt
powershell -command "& {Get-Content ../temp.txt -TotalCount 100}" > ../temp3.bat
gvim -c "execute \"normal! 100dd\"" -c "wq" ../temp.txt
[...]
powershell -command "& {Get-Content ../temp.txt -TotalCount 100}" > ../temp20.bat
gvim -c "execute \"normal! 100dd\"" -c "wq" ../temp.txt
- Run the following with file "C:\user\Documents\FI\le\x.bat" opened in gvim (use http://www.unit-conversion.info/texttools/random-string-generator/ if one or more of your filenames contain "```")
:%s/\\/\\\\/ge | %s/^mkdir "FilesToHere/gvim -c "%%s\/^\/move \\"\/g" -c "%%s\/$\/\\" \\"C:\\\\user\\\\Documents\\\\ex1\\\\ex 2\\\\FilesToHere/g | %s/"$/\\\\\\"\/g" -c "wq" ..\/temp```.bat/g | let i=1|g/```/s//\=i/|let i=i+1
- Run "C:\user\Documents\FI\le\x.bat", which contains
cd C:\user\Documents\FI\le\s
gvim -c "%%s/^/move \"/g" -c "%%s/$/\" \"C:\\user\\Documents\\ex1\\ex 2\\FilesToHere\\1\\\"/g" -c "wq" ../temp1.bat
gvim -c "%%s/^/move \"/g" -c "%%s/$/\" \"C:\\user\\Documents\\ex1\\ex 2\\FilesToHere\\1\\Example 1\\\"/g" -c "wq" ../temp2.bat
gvim -c "%%s/^/move \"/g" -c "%%s/$/\" \"C:\\user\\Documents\\ex1\\ex 2\\FilesToHere\\1\\2\\\"/g" -c "wq" ../temp3.bat
[...]
gvim -c "%%s/^/move \"/g" -c "%%s/$/\" \"C:\\user\\Documents\\ex1\\ex 2\\FilesToHere\\1\\Example9\\\"/g" -c "wq" ../temp20.bat
- Run "C:\user\Documents\FI\le\x.bat", which you changed to make contain
cd C:\user\Documents\FI\le\s\
call ..\temp1.bat
[...]
call ..\temp19.bat
call ..\temp20.bat
Note: If you get the error "'■t' is not recognized as an internal or external command,
operable program or batch file." (like I did, on Windows 10), then you have to convert whatever batch file(s) you are running from Unicode to ANSI. ( See also https://www.wilderssecurity.com/threads/problem-executing-cmd-files.209442/ )
I find this method to be very helpful if you are trying to move like 10,000 files into 100 folders (10,000/100=100 files/folder) and the 100 folders are spread out in a nonuniform way (e.g., the 100 folders are not all in one directory and the 100 folders have parent-child relationships with each other). Related links/text: