A
A
Artur Gabitov2015-11-03 09:31:33
Database
Artur Gabitov, 2015-11-03 09:31:33

How to split a million files?

Good morning.
Such a problem has arisen ... There is a folder with a volume of a million files on the external drive, which is very difficult to open and wait for the entire list to be loaded.
How can this folder be split into smaller directories of 1000 files each? If this is not the case for Windows, perhaps there are options for Linux or Mac? I can connect this drive to any of the systems.
Thanks :)

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Dimonchik, 2015-11-03
@dimonchik2013

www.cyberforum.ru/cmd-bat/thread630948.html
but easier in Python using glob
gis.stackexchange.com/questions/141107/using-folde...

R
Roman Mirilaczvili, 2015-11-03
@2ord

How to split Folder into multiple subfolders ?

let fileCount=3000
let dirNum=1

for f in *
do
[ -d $f ] && continue
[ $fileCount -eq 3000 ] && {
dir=$(printf "%03d" $dirNum)
mkdir $dir
let dirNum=$dirNum+1
let fileCount=0
}

mv $f $dir
let fileCount=$fileCount+1
done

Can be run via Cygwin...

Y
Yaroslav Lyzlov, 2015-11-03
@dixoNich

Write a simple script in bash?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question