M
M
Michael Compass2020-08-26 10:39:28
cmd/bat
Michael Compass, 2020-08-26 10:39:28

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

2 answer(s)
M
Michael Compass, 2020-10-01
@mik777em

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.

O
Olgeir, 2020-09-01
@Olgeir

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 question

Ask a Question

731 491 924 answers to any question