in reply to Limiting a glob
Don't use glob; use opendir and readdir to loop through the directory entries. Strip out file types you don't want to move (directories, system files, hidden files, etc) and use rename or File::Copy's move function. Alternatively, you can push the files you want to move in an array, move the files when the array is either filled or you run out of files (I think it's quite unlikely that the number of files mod 100 will be 0); in the former case, empty the array and iterate; in the latter, you're done.
Now, are you moving 100 files into a new directory for each 100 files or moving all the files into a single new directory?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Limiting a glob
by webfiend (Vicar) on Mar 09, 2009 at 18:03 UTC | |
by swampyankee (Parson) on Mar 09, 2009 at 22:30 UTC | |
by webfiend (Vicar) on Mar 09, 2009 at 22:36 UTC |
In Section
Seekers of Perl Wisdom