Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Directory Writable Question

Status
Not open for further replies.

heimer

Technical User
Mar 23, 2004
4
US
I am attempting to determine whether or not a selected directory is
writable.
I am using Active Tcl/Tk 8.4.5 on WinXP and accessing directories on both
Win and Unix. I let the user select a directory using tk_chooseDirectory. I
want to determine if I should disable a separate button that would call a
proc that copies some files to that directory.
I tried 'file writable $dir' and always get back 1, never 0 - even though I
have selected directories that I know I have no write access to.
I have also tried 'file stat $dir' and extracted the mode from the array and
always get the following
result: 16868
I have also tried 'file attributes $dir -readonly' and always get the value
0
I am at a loss.

Dave
-----------------

David L. Heim phone: (319)295-8616

400 Collins Road NE email: dlheim@rockwellcollins.com

Cedar Rapids, IA 52498

M/S 106-186


 
You say you are sure you have no write access to some drives but are you sure Tcl also doesn't. Just for jollies, try writing to one of them from the Tcl shell. Since Tcl was probably installed under administrator, it could be that Tcl has more access than a user does.

Just a thought.

Bob Rashkin
rrashkin@csc.com
 
Thanks for the reply.

I tried to create a file under the selected directory and
failed because I didn't have permission - as expected.

Dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top