How to split large folder into multiple folders

with a batch script

@echo off
setlocal enabledelayedexpansion

set folder=c:\files

set filecount=0
set foldercount=1
set maxfiles=100

for /F “tokens=*” %%G in (‘dir “%folder%” /A:-D /B’) do (
set /A filecount+=1
set target=0000!foldercount!
set target=!target:~-5!
if not exist “%folder%\!target!” md “%folder%\!target!”
move “%folder%\%%G” “%folder%\!target!”

if [!filecount!]==[%maxfiles%] (
set /A foldercount+=1
set filecount=0

Paste the script below into a text file and save it with a .cmd extension. Change the value of the line “set folder=c:\files” with your folder location.
Running the script will create sequentially-numbered subfolders and move 100 files into each one