|laziness, impatience, and hubris|
Limiting a globby zod (Scribe)
|on Mar 09, 2009 at 17:32 UTC||Need Help??|
zod has asked for the wisdom of the Perl Monks concerning the following question:
I've got ~40,000 files in a directory (Windows XP). Rather than globbing all of the files into an array at once, I am looking for a way to glob only a certain number at a time (let's say 100). Can you set a limit on a glob like that?
I guess I'm thinking in SQL here (which can be dangerous). I don't care about the order of the glob -- I just want 100 file names at a crack. (Like a TOP or LIMIT in SQL.)
The goal here is to move every 100 files into a newly created directory. It doesn't matter which 100 files, just 100 files. I know I could glob the whole dir into an array and then process the array 100 at a time, but I'm just curious if you can do it without globbing the whole dir at once.