We had this situation where we had to move around 53 million files (HTMLs) from a bunch of folder to some other folders. The files were located in no more than 100 files, having folders with 2.5 million files. One thing worth mentioning is that the disk where the files are is with spinning disks and is also a NFS, both of whch make the access really slow.
The reason we want to move all of these files is because we no longer want to keep them in a flat structure but
rather in a nested structure, using the date when the item was created; the dir structure would look something
like this: %Y/%m/%d/
. So we basically want to run mv $BASE_DIR/item_name.html.gz $BASE_DIR/%Y/%m/%d/item_name.html.gz
for each of those 53 million files.