1

We're an engineering company and for our project files, I only want certain group of people to have access to a costing subfolder. I'm looking at automating the permission of the costing folder.

Here's the problem in a bit more detail. I have on our Windows 2008 SBS Server a folder for Projects. Inside the Projects folder are the Projects labelled 1001, 1002 ect. Everyone has read/write permission to the sub folders except the costing folder. Only a security group called pre-sales have access to the costing folder. Here's an example folder structure

\project folder\Project 1001\

                           Costings
                           CAD files
                           development reports 
                           etc..

\project folder\Project 1002\

                           Costings
                           CAD files
                           development reports 
                           etc..

etc.....

we have a template folder called "standard folder layout" that staff copy and rename to the project number when creating a new project (to save time creating each sub folders). I've amended the permission on the "standard folder layout" sub folder "costings" but the permissions do not copy across for costings. Whats the best way to take the permissions accross?

resolver101
  • 301
  • 3
  • 7
  • 17

2 Answers2

2

In addition to Jon's answer, you'll be looking for something like this:

:start
SET /P fold= Enter the Project name: 
ECHO.
CHOICE /M "Is this correct: %fold%"
IF %ERRORLEVEL% equ 2 CLS & GOTO start
ECHO.

robocopy "project folder\Template" "project folder\%fold%" /MIR /SEC /XX /A-:H >nul 2>nul

There's other stuff you could add such as custom error messages, a slight pause with information about success/failure, etc. but this should cover the basics. /MIR handles the copying of the folder structure, /SEC copies over the permissions, /XX tells it to not delete existing files if they accidentally type in a project name that already exists, /A-:H removes the hidden attribute (so you can hide the template folder), and the >nul 2>nul just hides a lot of the output. Change source and destination as needed and you basically have the script that Jon mentions in his comment.

Now all you have to do is make sure that your template folder has the correct permissions setup. I would recommend Helge Klein's SetACL Studio if you have more than just a small handful of folders to work on. It's a lot quicker than opening all those property pages for each and every single folder.

Falcon Momot
  • 25,244
  • 15
  • 63
  • 92
Fiernaq
  • 41
  • 7
0

I would use robocopy command to do what you want. It will copy your standard folder with its permissions.

Jon
  • 339
  • 2
  • 10
  • The solution has potential. We would probably have to use it in conjunction with a file watcher to make it automatic. I found this post: http://stackoverflow.com/questions/29066742/watch-file-for-changes-and-run-command-with-powershell. – resolver101 Jul 02 '15 at 07:21
  • I think you may be complicating things. If you already have people manually copying your folder template then why create such a long script to use with robocopy? I like keeping things simple. By default when you copy something it will inherit permissions from the parent folder. I would just put robocopy in a script that anyone with write permissions to the project folder can run. So when they needed another folder they just run the script & it will copy the folder with the correct permissions already. – Jon Jul 03 '15 at 12:36
  • I've also heard good things about emcopy. – Basil Oct 08 '15 at 00:28