Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Checking "Modify" property of the file on windows

by BrowserUk (Patriarch)
on Jul 03, 2016 at 12:33 UTC ( [id://1167059]=note: print w/replies, xml ) Need Help??


in reply to Checking "Modify" property of the file on windows

it appears that on windows to delete the file i need to be able to modify it (even if I can read and write the file i may not be able to delete it).

Correct! It can also be more complex than that.

The simplest way to get the full DACLs for a file or directory is:

$dir = 'users'; $rights = `icacls $dir`; print $rights;; users NT AUTHORITY\SYSTEM:(OI)(CI)(F) BUILTIN\Administrators:(OI)(CI)(F) BUILTIN\Users:(RX) BUILTIN\Users:(OI)(CI)(IO)(GR,GE) Everyone:(RX) Everyone:(OI)(CI)(IO)(GR,GE) Successfully processed 1 files; Failed processing 0 files

See the help for the icacls command for the explanation of the output

Its not the friendliest format for the information, but it is easily parsed for specific purposes.

Alternatively, take a look at jenda's Win32::FileSecurity. Be warned, it has limitations, lacks documentation and isn't the simplest of interfaces.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority". I knew I was on the right track :)
In the absence of evidence, opinion is indistinguishable from prejudice. Not understood.

Replies are listed 'Best First'.
Re^2: Checking "Modify" property of the file on windows
by Anonymous Monk on Jul 03, 2016 at 19:29 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1167059]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2024-03-19 03:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found