![]() |
Check directory permissions
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? |
Check directory permissions
Why not just check for an error after they (try to) save the file--why bother
with the test file? Dave T wrote: 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? -- Dave Peterson |
Check directory permissions
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. On Mar 22, 6:48 pm, Dave Peterson wrote: Why not just check for an error after they (try to) save the file--why bother with the test file? Dave T wrote: 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? -- Dave Peterson |
Check directory permissions
Then I'd test it with a testfile.
Dave T wrote: 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. On Mar 22, 6:48 pm, Dave Peterson wrote: Why not just check for an error after they (try to) save the file--why bother with the test file? Dave T wrote: 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? -- Dave Peterson -- Dave Peterson |
Check directory permissions
Okay. Thank you.
On Mar 23, 10:54 am, Dave Peterson wrote: Then I'd test it with a testfile. Dave T wrote: 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. On Mar 22, 6:48 pm, Dave Peterson wrote: Why not just check for an error after they (try to) save the file--why bother with the test file? Dave T wrote: 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? -- Dave Peterson -- Dave Peterson- Hide quoted text - - Show quoted text - |
All times are GMT +1. The time now is 05:44 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com