[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Create a folder and set permissions from a txt file.

Posted on 2009-02-24
6
Medium Priority
?
551 Views
Last Modified: 2012-05-06
Hi,

Create a folder and set permissions from a txt file.
I have the uer names in a txt file. Need to create the folder name as the user name and set everyone full access in the share and set the user name as Full access in the security permissions.
No one else just that user should be in there.

Windows 2003 server i need to create these folders.

REgards
Sharath'
0
Comment
Question by:bsharath
  • 4
  • 2
6 Comments
 
LVL 21

Expert Comment

by:AmazingTech
ID: 23724550
Give this a try.
Set ShareFolder=D:\TestFolder
Set Domain=YourDomain
for /f %%a in (Users.txt) do call :process "%%a"
goto :eof
 
:process
set folder=%~1
set fullpath=%ShareFolder%\%Folder%
md "%fullpath%"
net share %folder%="%fullpath%" /grant:Everyone,Full
echo y|cacls "%fullpath%" /t /g %domain%\%folder%:F %domain%\Administrator:F SYSTEM:F
pause

Open in new window

0
 
LVL 11

Author Comment

by:bsharath
ID: 23724635
Hi AT how are you...Long time no see... :-))

I get this

C:\>Set ShareFolder=c:\

C:\>Set Domain=Development

C:\>for /F %a in (Users.txt) do call :process "%a"

C:\>call :process "sharath"

C:\>set folder=sharath

C:\>set fullpath=c:\\sharath

C:\>md "c:\\sharath"

C:\>net share sharath="c:\\sharath" /grant:Everyone,Full
System error 123 has occurred.

The filename, directory name, or volume label syntax is incorrect.


C:\>echo y  | cacls "c:\\sharath" /t /g Development\sharath:F Development\Admi
nistrator:F SYSTEM:F
Are you sure (Y/N)?processed dir: c:\sharath

C:\>pause
Press any key to continue . . .

I have the cacls in the same folder too
0
 
LVL 21

Accepted Solution

by:
AmazingTech earned 2000 total points
ID: 23724746
Yes. It has been awhile. I've been mainly in MSDOS and Windows Batch Scripting. Not too much in vbscript. Trying to save my time doing other things.

Your son must be getting big.

Modify your sharefolder.

Set ShareFolder=C:
Set ShareFolder=C:
Set Domain=YourDomain
for /f %%a in (Users.txt) do call :process "%%a"
goto :eof
 
:process
set folder=%~1
set fullpath=%ShareFolder%\%Folder%
md "%fullpath%"
net share %folder%="%fullpath%" /grant:Everyone,Full
echo y|cacls "%fullpath%" /t /g %domain%\%folder%:F %domain%\Administrator:F SYSTEM:F
pause 

Open in new window

0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 11

Author Comment

by:bsharath
ID: 23729900
Thanks AT

Ya my Son is doing really fine.. He has been growing tooo fast.

:-)

Please take time to have a view at my posts when time permists... :-)
0
 
LVL 11

Author Comment

by:bsharath
ID: 23729901
Thanks AT

Ya my Son is doing really fine.. He has been growing tooo fast.

:-)

Please take time to have a view at my posts when time permists... :-)
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
This article will show, step by step, how to integrate R code into a R Sweave document
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses
Course of the Month18 days, 3 hours left to enroll

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question