Check directory permissions

D

Dave T

I've got a little script which needs to put it's output in a user-
specified directory and I'd like to make sure that the user has
permission to write to the directory before letting the script try.

I've seen some posts which suggest trying to write a file to the
directory first, while other suggested using GetAtrr(). GetAtrr()
only seems to want to tell me that the specified directory is in fact
a directory.

Is there a simple way to check that the user has write permissions or
am I better off try to write a file and trapping that error?
 
D

Dave Peterson

Why not just check for an error after they (try to) save the file--why bother
with the test file?
 
D

Dave T

When the initial dialogue that let's them select their output
directory comes up I'd like it to warn them immedeately if they picked
a directory that they shouldn't have.
The script is producing a few hundred little text files, and I'd like
it to be more "fire-and-forget". So if there is something quick and
easy, I'd rather do that at the start than have to trap an error and
force the user to pay attention after the setup.
 
D

Dave Peterson

Then I'd test it with a testfile.



Dave said:
When the initial dialogue that let's them select their output
directory comes up I'd like it to warn them immedeately if they picked
a directory that they shouldn't have.
The script is producing a few hundred little text files, and I'd like
it to be more "fire-and-forget". So if there is something quick and
easy, I'd rather do that at the start than have to trap an error and
force the user to pay attention after the setup.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top