Leonardo Duarte
asked on
Script to disable inheritance of folders and subfolders and files
Hello friends, how are you?
I need a script that turns off the inheritance option for folders, subfolders, and files.
The structure of the folders is as follows:
Parent folder: FS
Child folders inside the FS folder:
COMERCIAL
ENGINEERING
SALES
I need the scripts to remove the inheritance folder from the FS folder in the COMMERCIAL, ENGINEERING, AND SALES folders and in the subfolders and files within them.
In other words the child folders can not inherit the parent's permission.
I need the script to do the disable inheritance action while retaining the permissions of the inherited FS folder.
Can anyone help?
I need a script that turns off the inheritance option for folders, subfolders, and files.
The structure of the folders is as follows:
Parent folder: FS
Child folders inside the FS folder:
COMERCIAL
ENGINEERING
SALES
I need the scripts to remove the inheritance folder from the FS folder in the COMMERCIAL, ENGINEERING, AND SALES folders and in the subfolders and files within them.
In other words the child folders can not inherit the parent's permission.
I need the script to do the disable inheritance action while retaining the permissions of the inherited FS folder.
Can anyone help?
ASKER
Hello NVIT,
I need the script to turn off inheritance of files as well, not just folders.
Can you adjust the script?
I need the script to turn off inheritance of files as well, not just folders.
Can you adjust the script?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
> I need the scripts to remove the inheritance folder from the FS folder in the COMMERCIAL, ENGINEERING, AND SALES folders and in the subfolders and files within them.
Do you need it for just COMMERCIAL, ENGINEERING, AND SALES folders? Are there adjacent folders next to those you want to avoid?
The following code disables inheritance for all folders under e:\fs, including their sub-folders.
1. Make a .bat file of the code.
2. Open a cmd window
3. Run the .bat file
IMPORTANT: It's best to test it on a test folder first, just to be sure. To do so, change the value to the right of Dir= to point to the test folder, e.g. Dir=e:\test
Open in new window