Announcement

Collapse
No announcement yet.

How to programmatically manipulate file permissions etc...

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Knuth Konrad
    replied
    Paul Purvis already showcased the ICACLS tool. Another way to do it is with PowerShell: https://blogs.msdn.microsoft.com/joh...ile-or-folder/. I recommend to become familiar with PS, as it will slowly take over the old CMD world. Bonus point: it's available for Linux, too. So your scripts can potentially run an various OSs.

    Leave a comment:


  • Pierre Bellisle
    replied
    You may have a look at Change file or folder ownership on NTFS drive

    Leave a comment:


  • Paul Purvis
    replied
    how about a batch file
    has to be run as the administrator to give all access to directory including delete it, i believe.
    this should give access to read and write to the drive directory and all files in the directory and sub directories inside it to all users.
    I never go back to removing rights. I guess you could delete the directory if needed to reset it.

    giverdrw.bat
    Code:
    ECHO OFF
    cls
    IF EXIST "C:\%1" GOTO DOIT
    GOTO BAD
    :DOIT
    icacls "c:\%1" /grant:r Users:(OI)(CI)F /T
    GOTO QUIT
    :BAD
    ECHO bad directory name
    ECHO %1
    :QUIT

    commands to give total rw access and all other rights to directories and files under the root c: drive for the listed directories
    to give totall access to these directories
    c:\inhouse
    c:\other
    c:\otherdll
    c:\temp

    c:\wsbat is the directory location where i keep all my batch processes

    run the below as an administrator
    Code:
    call c:\wsbat\giverdrw inhouse
    call c:\wsbat\giverdrw other
    call c:\wsbat\giverdrw otherdll
    call c:\wsbat\giverdrw temp


    for what it is worth, i set all my other drives letters other than c: to be used by all users using the disk management tools in area. diskmgmt.msc
    Most of the time, I set the other than c: drives to users but you can set it to everyone and be done with it.

    Leave a comment:


  • Jim Fritts
    replied
    Tim,
    Look in WinNT.inc and WinBase.inc.

    Leave a comment:


  • Tim Lakinir
    replied
    This looks difficult to convert to PB from VB, how to convert this method to PB?

    https://support.microsoft.com/en-us/...ship-of-a-file

    Leave a comment:


  • David Clarke
    replied
    Thanks for the link Stuart!

    https://support.microsoft.com/en-us/...ship-of-a-file

    Leave a comment:


  • David Clarke
    replied
    Thanks guys!

    I was talking about the permissions like Read, Write, Read&Write, List Folder Contents, Modify and Full Control. Also how to change the owner from Trusted Installer to something else.

    Leave a comment:


  • John Montenigro
    replied
    Check the PB Help file:
    SETATTR filespec$, attribute
    Sets the file system attribute(s) of a disk file or directory.

    -John

    Leave a comment:


  • Stuart McLachlan
    replied
    User permissions or attributes?

    If useers permissions, permissions on the original or the copies?
    Permissions are applied to the copied files based on the permissions of the directory they are being copied to.
    If attributes, Shell to a Cmdline and use "attrib".

    To alter user permissions on the original file is a lot more complex Here's some VB code which you may be able to adapt:
    https://support.microsoft.com/en-us/...ship-of-a-file

    Leave a comment:


  • How to programmatically manipulate file permissions etc...

    Anyone know how to programmatically manipulate file permissions etc...

    I am trying to figure out how to strip all permissions from files as I move them from my old C drive to a backup location.
Working...
X