How to set permissions on directory?

16,562

Use the icacls command:

icacls "%ProgramFiles(x86)%\folder" /grant "Domain Users":f /t /q

This command will grant read/write permissions to all domain users in folder and all files and subfolders in it.

Explanation:

/grant
:r  Read Access
user:permission
:f  Full access
/t  Traverse all subfolders to match files/directories.
/q  Quiet - supress success messages.
Share:
16,562

Related videos on Youtube

VidyaEvolution
Author by

VidyaEvolution

Updated on September 18, 2022

Comments

  • VidyaEvolution
    VidyaEvolution over 1 year

    I am searching for a way to set permissions on folder and the contents.

    The rule is as such that the only the superuser can delete contents of the folder. Users can add, view, modify, but not delete the files in the directory.

    • Arvind Jha
      Arvind Jha over 11 years
      Which OS do you use?
    • dsolimano
      dsolimano over 11 years
      Are you concerned about users deleting files but not, for example, opening them up and deleting all of the contents?
  • VidyaEvolution
    VidyaEvolution over 11 years
    MAC OS X 10 Lion
  • VidyaEvolution
    VidyaEvolution over 11 years
    Thank you for the solution. This will work with windows only. I am currently using Mac OS X Lion.