http://qs321.pair.com?node_id=749368


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?


Information about American English usage here and here. Floating point issues? Please read this before posting. — emc

Replies are listed 'Best First'.
Re^2: Limiting a glob
by webfiend (Vicar) on Mar 09, 2009 at 18:03 UTC

    It's all fair advice, but why wouldn't zod want to use glob?

      I've no idea why zod wouldn't want to; I just offered him a way to do so without using glob.


      Information about American English usage here and here. Floating point issues? Please read this before posting. — emc