Re: How to determine if a folder exists on a system?
Re: How to determine if a folder exists on a system?
- Subject: Re: How to determine if a folder exists on a system?
- From: Emmanuel LEVY <email@hidden>
- Date: Wed, 8 Jul 2009 22:34:47 +0200
On Jul 8, 2009, at 10:01 PM, Mark J. Reed wrote:
On Wed, Jul 8, 2009 at 3:53 PM, Emmanuel LEVY<email@hidden>
wrote:
Just to remind those who might feel concerned that mkdir can yield
unpredictible results if the path you want to "mk" includes a
symbolic link.
That is, don't try to mkdir /foo/bar/nonexistingfolder/ if foo is
really a
symbolic link to some folder. So, to be 100% safe, mkdir should be
used only
one level at a time.
What is this inconsistency of what you speak? IME mkdir traverses the
link and creates the new directory in the target. That would seem to
be the correct behavior. We certainly don't want to remove the link
and create a new directory in its place that's empty except for the
new dir being created...
I trust that the bug never hit you, but you can trust me too: mkdir /
foo/symlink/bar/fred/ may (but will not always) make a corrupted
"fred" folder. The main symptoms I know are: 1. the said folder does
not seem to exist for the system (posix file "/foo/resolvedsymlink/bar/
fred" as alias fails), 2. in Finder, no "fred", but - assume bar/
already contained lisa/ - two items named lisa. IME restarting the
machine solves the problem, that is, fixes the corrupted folders.
Anyway, how do you propose to solve it by going one level at a time?
Now you certainly see my point: since you don't want to feed mkdir
with a path which would include a symlink, you really to have mkdir's
recursive job by yourself: since you have to figure out the resolved
path, you have to figure out what level the hierarchy already exists
up to.
Emmanuel
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden