Answer the question
In order to leave comments, you need to log in
How to split a folder with 100k TXT files into 10 folders of 10k TXT files?
Good afternoon. Tell me a simple bat script or another way how to split a folder with 100k TXT files into 10 folders of 10k TXT files?
Answer the question
In order to leave comments, you need to log in
made it easier. Press cntr+M in total commander. Next, specify [C+1/555]\[N]
Where 555 is the number of files you want in each folder. And we press to execute.
Correct for your environment
@echo off
set file_count=0
set folder=0
for %%a in (*.txt) do call :move_file %%a
exit
:move_file
set /a file_count=%file_count% + 1
if %file_count% GTR 10000 set file_count=0 && set /a folder=%folder%+1
md %folder% 1>nul 2>nul
move "%~1" %folder%
goto :eof
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question