Ugh! Yep, you're right, my bad... only, the code is too long for my liking. Can it be shorter? Could I use the operating system to pare down the code a bit by pre-gathering a list of all files? Something like
my @files = (reverse sort `dir /A-D /S`)[0..9];
In DOS, or ... (big pause)...
Aw shoot, in DOS the solution isn't even perl:
dir /A-D /O-S /S
That recursively lists all files from the current working directory on, sorted by largest file first. I imagine there's a combination of opts to ls that will do the same thing, eh? Maybe
ls -alSR (which doesn't sort across directories)
ls -alR | sort -k 5 (maybe?)
(Except those don't suppress the directory names. Hmmm.)
Sorry, I meant to write perl, but it came out rather OS-specific... but it's a lot smaller than the perl solution. Is that Appeal To False Laziness?
| [reply] [d/l] [select] |
| [reply] [d/l] |
++QM
That's what I get for posting off the cuff. Still, there ought to be a way to leverage such listings for sorting purposes -- the filesize is listed before the filename: all you'd have to do in the DOS world is lop off the timestamps in front and tweak a bit, then perl's sort() should work like a charm. Nice and compartmentalized, yes?
| [reply] |