Create, write to, close and make readonly?

Create, write to, close and make readonly?

mdhutchinson
Advisor Advisor
511 Views
9 Replies
Message 1 of 10

Create, write to, close and make readonly?

mdhutchinson
Advisor
Advisor
I've got code that writes to a csv file...

How can I make the file readonly?
0 Likes
512 Views
9 Replies
Replies (9)
Message 2 of 10

Anonymous
Not applicable
"SetAttr strFile, GetAttr(strFile) And (vbReadOnly)" will set strFile read
only

"SetAttr strFile, GetAttr(strFile) And (vbReadOnly)" will set strFile
read/write

-Chris

wrote in message news:5452220@discussion.autodesk.com...
I've got code that writes to a csv file...

How can I make the file readonly?
0 Likes
Message 3 of 10

Anonymous
Not applicable
oops.....that should read:

"SetAttr strFile, GetAttr(strFile) And (vbReadOnly)" will set strFile
read-only

"SetAttr strFile, GetAttr(strFile) And (NOT vbReadOnly)" will set strFile
read/write

"Chris Shoemaker" wrote in message
news:5452264@discussion.autodesk.com...
"SetAttr strFile, GetAttr(strFile) And (vbReadOnly)" will set strFile read
only

"SetAttr strFile, GetAttr(strFile) And (vbReadOnly)" will set strFile
read/write

-Chris

wrote in message news:5452220@discussion.autodesk.com...
I've got code that writes to a csv file...

How can I make the file readonly?
0 Likes
Message 4 of 10

mdhutchinson
Advisor
Advisor
I found that this still doesn't prevent the file from being deleted by a user. This is what I was hoping to do.
I suppose if I make the folder readonly this would do it.

Thanks
0 Likes
Message 5 of 10

Anonymous
Not applicable
No...they'll still be able to delete it....just not edit or append to it.
You wouldn't be able to write to it either until you shut off the read-only
flag. Its not a replacement for actual file level access control.

-Chris

wrote in message news:5452287@discussion.autodesk.com...
I found that this still doesn't prevent the file from being deleted by a
user. This is what I was hoping to do.
I suppose if I make the folder readonly this would do it.

Thanks
0 Likes
Message 6 of 10

mdhutchinson
Advisor
Advisor
Short of setting the folder with security that will prevent deletion... Is there a file level property that can be set that will prevent deletion?
0 Likes
Message 7 of 10

Anonymous
Not applicable
Nothing I can think of. Though if it's on an NTFS volume you could use the
file-level permissions, but I get the feeling that wouldn't help what you're
trying to do.

-Chris

wrote in message news:5452757@discussion.autodesk.com...
Short of setting the folder with security that will prevent deletion... Is
there a file level property that can be set that will prevent deletion?
0 Likes
Message 8 of 10

Anonymous
Not applicable
Hi Hutch,

Network administrators can set permissions to allow write to a folder and
prevent deletion from the folder.

If the user has permission to write the file, they probably have permission
to edit it. Even if you set the read only attribute, users can change the
it and by editing they can destroy the usefulness of the file without
necessarily deleting it.

You best bet to resolve your needs is training.

--

Laurie Comerford
CADApps
www.cadapps.com.au
www.civil3Dtools.com

wrote in message news:5452287@discussion.autodesk.com...
I found that this still doesn't prevent the file from being deleted by a
user. This is what I was hoping to do.
I suppose if I make the folder readonly this would do it.

Thanks
0 Likes
Message 9 of 10

Anonymous
Not applicable
you can change the security on the file itself so only you can edit it, but i don't think you can put that into code if you want it done automatically, and you will still be able to delete it
0 Likes
Message 10 of 10

mdhutchinson
Advisor
Advisor
My program generates data from piece marks (attributed blocks) and associated geometry across several drawings.

Once the drawings go out for approval the data collected is 'locked' ... the code ran when the 'lock' widget is clicked by the user. Code runs to write a 'lock' file to that projects 'data' folder. Inside the ‘lock’ file is the users name and time the ‘lock’ was put in place. To unlock the data, the user must manually delete the file… the reason I wanted to place security on the file is to make it a little more difficult to delete…

I guess what I have is sufficient without the security.

Thanks to all for your thoughts.
0 Likes