Here's one way. Take out the
prints when you have finished testing. The
tail +2 is to skip the total blocks displayed by
ls -l. This will not work if any of the filenames contain spaces.
Code:
i=0
split=1000
ls -l | tail +2 | sort -rn -k 5,5 | awk '{print $NF}' | while read f
do
(( i%${split}==0 )) && print mkdir subdir$(( i/${split} ))
print mv $f subdir$(( i/${split} ))
(( i=i+1 ))
done