in reply to splitting directories

You can use the core opendir and readdir functions. I think you should read file by file (due the number of files) and move them using File::Copy.

use File::Copy; use File::Spec; my $filecount = 0; my $dircount = 0; opendir my $basedir, "." or die $!; while (my $file = readdir($basedir)) { next if $file =~ /^\.\.?$/ or -d $file; my $targetdir = "dir${dircount}"; do { mkdir $targetdir or die $!; } unless -d $targetdir; move($file, File::Spec->catfile($targetdir, $file)) or do { warn $ +!; next; }; if ($filecount > 999) { $filecount = 0; $dircount++; } } closedir $basedir or die $!;

Igor 'izut' Sutton
your code, your rules.