Re: getting a file list in sorted order
Re: getting a file list in sorted order
- Subject: Re: getting a file list in sorted order
- From: Christopher Nebel <email@hidden>
- Date: Tue, 20 Aug 2002 20:12:00 -0700
On Tuesday, August 20, 2002, at 12:30 PM, John Delacour wrote:
At 4:50 pm -0700 19/8/02, Christopher Nebel wrote:
On Monday, August 19, 2002, at 03:50 PM, John Delacour wrote:
set s to "cd ;perl -e '
$dir = qq~/users/jd~; opendir DIR, $dir ;
for (readdir DIR){print ; print $/}'"
do shell script s
If you want that to give you the results in sorted order, you'd
better stick a " | sort" at the end of that script -- otherwise,
you'll just get the results in directory order
That's not my experience. No matter how I sort the directory in the
Finder, the result is the same.
That's because you're using an HFS+ disk. What I meant by "directory
order" is not what the Finder's showing you, but rather the order that
the files are in in the raw directory entry on disk. What I said about
"list folder" applies to this method as well -- you're actually getting
the items in directory order, but HFS+ stores them in alphabetical
order, so the resulting list is properly ordered. Try the same stunt
on just about any other disk format, however, and you'll get an
unordered list. I don't mind people relying on this, but don't be
deluded into thinking that your code is doing something that it's not.
Come to think of it, why not just use "ls -A"?
Because I would quickly run out of useful things to do with my limited
knowledge of Unix scripting and I didn;t buy a Mac in 1984 because I
envied those geeks with the green command lines!
As for perl, I just love it -- it even has documentation!
Yes, well, so does sh. Perl may be a Swiss-army chainsaw, but for some
tasks a simple knife works just as well and is a lot less trouble to
carry around.
--Chris Nebel
AppleScript Engineering
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.