[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Portably iterate over a directory
- From: Alexander Gladysh <agladysh@...>
- Date: Tue, 1 Dec 2009 13:09:21 +0300
On Tue, Dec 1, 2009 at 02:07, Rob Kendrick <lua-l@nun.org.uk> wrote:
> On Mon, 30 Nov 2009 23:54:48 +0300
> Alexander Gladysh <agladysh@gmail.com> wrote:
>> > This won't work reliably due to charset issues, I fear. You really
>> > have to use proper operating system APIs for this job.
>> Even if I don't need absolute paths and all files and sub-directories
>> that I traverse are guaranteed to be contain [a-zA-Z_-.] only?
> There are too many issues to count. Like, "What if the user has
> aliased {dir,ls} to something else unexpected?"
> This is very common in the UNIX world.
I think this can be solved (in most cases) by using /bin/ls.
While I'd like to have universal solution, what I need is a practical
one, that would work out of the box for the most common cases.
If user is smart enough to modify his environment so it breaks the
utility, he should be smart enough to fix it. (The utility is for
programmers, after all.)
Alexander.