Discussion:
Folder Permissions
(too old to reply)
Graham
2010-07-20 02:02:24 UTC
Permalink
Is there a way to change folder permissions programatically. I need
to grant full access to two folders (which are subfolders of my
program directory) as shown below

c:\My Program File\tempzio
and
c:\My Program File\Move

Currently I delete files in these two folders on program exit, which
is fine on XP but both Vista and 7 require explicit permissions.
Gene Wirchenko
2010-07-20 19:31:17 UTC
Permalink
On Mon, 19 Jul 2010 19:02:24 -0700 (PDT), Graham
Post by Graham
Is there a way to change folder permissions programatically. I need
to grant full access to two folders (which are subfolders of my
program directory) as shown below
c:\My Program File\tempzio
and
c:\My Program File\Move
Currently I delete files in these two folders on program exit, which
is fine on XP but both Vista and 7 require explicit permissions.
Are the files temporary files? Create cursors instead of .dbf
files, etc., or create the files in a temp directory.

Sincerely,

Gene Wirchenko
Graham
2010-07-21 16:38:39 UTC
Permalink
On Jul 20, 3:31 pm, Gene Wirchenko <***@ocis.net> wrote:

The files are temporary mulitmedia files. So I just need to unzip
these files (if required) and then delete after use. I currently have
just been using delete file c:\My Program File\tempzip\*.* at program
exit.

So what I should do then is reference the windows temp folder and
unzip the file to there?

"lctempfolder=sys(2023)
lcfiletounzip=addbs(lctempfolder)+file to unzip"

Do Vista and Windows 7 allow you to delete from the temp folder or is
that something that the OS looks after for you.

Thanks for your help.
Post by Gene Wirchenko
On Mon, 19 Jul 2010 19:02:24 -0700 (PDT), Graham
Is there a way to change folder permissions programatically.  I need
to grant full access to two folders (which are subfolders of my
program directory) as shown below
c:\My Program File\tempzio
and
c:\My Program File\Move
Currently I delete files in these two folders on program exit, which
is fine on XP but both Vista and 7 require explicit permissions.
     Are the files temporary files?  Create cursors instead of .dbf
files, etc., or create the files in a temp directory.
Sincerely,
Gene Wirchenko
Gene Wirchenko
2010-07-21 17:24:42 UTC
Permalink
On Wed, 21 Jul 2010 09:38:39 -0700 (PDT), Graham
Post by Graham
The files are temporary mulitmedia files. So I just need to unzip
these files (if required) and then delete after use. I currently have
just been using delete file c:\My Program File\tempzip\*.* at program
exit.
I have not had to deal with it myself, but later versions of
Windows are sticky about where you can write. "\Program Files" is one
of these.
Post by Graham
So what I should do then is reference the windows temp folder and
unzip the file to there?
"lctempfolder=sys(2023)
lcfiletounzip=addbs(lctempfolder)+file to unzip"
That is one possibility. Another is to create a temp directory
elsewhere.
Post by Graham
Do Vista and Windows 7 allow you to delete from the temp folder or is
that something that the OS looks after for you.
I do not know. I do not see why you should be prevented.

You might look at
http://msdn.microsoft.com/en-us/library/aa363875%28VS.85%29.aspx
Post by Graham
Thanks for your help.
You are welcome.

[snipped previous]

Sincerely,

Gene Wirchenko
john3
2010-07-21 18:38:54 UTC
Permalink
Post by Gene Wirchenko
On Wed, 21 Jul 2010 09:38:39 -0700 (PDT), Graham
The files are temporary mulitmedia files.  So I just need to unzip
these files (if required) and then delete after use.  I currently have
just been using delete file c:\My Program File\tempzip\*.* at program
exit.
     I have not had to deal with it myself, but later versions of
Windows are sticky about where you can write.  "\Program Files" is one
of these.
So what I should do then is reference the windows temp folder and
unzip the file to there?
"lctempfolder=sys(2023)
lcfiletounzip=addbs(lctempfolder)+file to unzip"
     That is one possibility.  Another is to create a temp directory
elsewhere.
Do Vista and Windows 7 allow you to delete from the temp folder or is
that something that the OS looks after for you.
     I do not know.  I do not see why you should be prevented.
     You might look athttp://msdn.microsoft.com/en-us/library/aa363875%28VS.85%29.aspx
Thanks for your help.
     You are welcome.
[snipped previous]
Sincerely,
Gene Wirchenko
...or maybe call the old DOS "attrib" command as in "attrib -r" to
remove read-only.
That's all I got, but maybe someone can make it more complete?
john3
Graham
2010-07-22 03:00:45 UTC
Permalink
Thanks Gene but the program directory is actually off of the root
drive

i.e. c:\ProgramName
and the two other directories are subdirectories of the above.

I think the idea of using the GetTempPath a great idea.

But I am intrigued by John3's idea, if indeed permissions is based on
the attrib
flag of a file.
Gene Wirchenko
2010-07-22 05:17:49 UTC
Permalink
On Wed, 21 Jul 2010 20:00:45 -0700 (PDT), Graham
Post by Graham
Thanks Gene but the program directory is actually off of the root
drive
i.e. c:\ProgramName
and the two other directories are subdirectories of the above.
Pardon me. I misread.
Post by Graham
I think the idea of using the GetTempPath a great idea.
But I am intrigued by John3's idea, if indeed permissions is based on
the attrib
flag of a file.
That is just a simple and early permission that dates back to
MS-DOS.

While I have not looked into it, you should probably try
searching on "Windows ACL" or "Windows Access Control List". An ACL
is one way of implementing permissions. For example, you can say to
allow user foo to read a file but not write it and give user bar read
and write permission.

Sincerely,

Gene Wirchenko
Graham
2010-07-22 17:07:19 UTC
Permalink
I'll look into the Windows ACL

Thanks Gene

Loading...