in reply to
Re^2: Finding and sorting files in massive file directory
in thread Finding and sorting files in massive file directory
So basically this reads one file into memory at a time?
No, it reads one filename
at a time into memory.
Do you know how to deal with zipping and tarring each file up in that case?
Well I've already shown you the easy way to compress individual files with the external gzip command. If you want to combine multiple file into a single tar file (possibly compressed), you're going to have to be more specific: how many files approximately are you wanting to put in a single tar file? All 2 million of them? Or just a select few? And do you want to delete the files afterwards?
You are likely to need to use the Archive::Tar module.