Moving folders around

  • Thread starter Hank Eisenstein Google
  • Start date
H

Hank Eisenstein Google

We are getting ready to migrate from an NT4 domain to an AD domain,
and part of that process requires that I move user shares around. I
have two directories, \svr\user$, and \svr\profile$. I need to move
these folders and all their contents to \newsvr\user$ and
newsvr\profile$. I took ownership, granted myself full control over
all the files, and copied them, using these commands:

subinacl /subdirectories \\svr\user$\*.* /setowner="domname\domain
admins"

xcacls \\svr\user$\*.* /t /e /g "domname\domain admins":f

xcopy \\svr\user$\*.* \\newsvr\user$\*.* /e/h/k/o/i

Now the problem I have is reassigning the appropriate ownership and
permissions to each user folder. I also need to assign the
permissions to the %username% folder. Doing them one at a time, I've
needed to do this:

subinacl /subdirectories \\newsvr\user$\[username]
/setowner="domname\[username]"

subinacl /subdirectories \\newsvr\user$\[username]\*.*
/setowner="domname\[username]"

As you can imagine, this is incredibly tedious. Is there a way to do
this automatically for all users in a certain directory?

Thanks for your assistance.
-Hank
 
D

Dmitry Korolyov

Do you know about a shell built-in "for" command?
If you do, you should be able to perform the task. First, obtain a list of
usernames in a text file (dir /b >userlist.txt is a possibility). Then, use
that text file as list source for the "for" command and perform the commands
you need to transfer data in one big batch.
 
H

Hank Eisenstein

I've never been good a scripts or batch files. Something we tried was

for /f %d in ("user profiles") do for /d %i IN (\\newsvr\%d$\*) DO subinacl
/subdirectories \\newsvr\%d$\%i\*.* /setowner=domname\%i && xcacls
\\newsvr\%d$\%i\*.* /t /g domname\%i:f

which didn't work very well at all. I'm unclear on exactly what it's doing,
because when we ran it on a test group, it wasn't pretty.
-Hank

Dmitry Korolyov said:
Do you know about a shell built-in "for" command?
If you do, you should be able to perform the task. First, obtain a list of
usernames in a text file (dir /b >userlist.txt is a possibility). Then, use
that text file as list source for the "for" command and perform the commands
you need to transfer data in one big batch.

--
Dmitry Korolyov
(e-mail address removed)
To e-mail me, remove "nospamformorons"
from the address.


Hank Eisenstein Google said:
We are getting ready to migrate from an NT4 domain to an AD domain,
and part of that process requires that I move user shares around. I
have two directories, \svr\user$, and \svr\profile$. I need to move
these folders and all their contents to \newsvr\user$ and
newsvr\profile$. I took ownership, granted myself full control over
all the files, and copied them, using these commands:

subinacl /subdirectories \\svr\user$\*.* /setowner="domname\domain
admins"

xcacls \\svr\user$\*.* /t /e /g "domname\domain admins":f

xcopy \\svr\user$\*.* \\newsvr\user$\*.* /e/h/k/o/i

Now the problem I have is reassigning the appropriate ownership and
permissions to each user folder. I also need to assign the
permissions to the %username% folder. Doing them one at a time, I've
needed to do this:

subinacl /subdirectories \\newsvr\user$\[username]
/setowner="domname\[username]"

subinacl /subdirectories \\newsvr\user$\[username]\*.*
/setowner="domname\[username]"

As you can imagine, this is incredibly tedious. Is there a way to do
this automatically for all users in a certain directory?

Thanks for your assistance.
-Hank
 
M

Mo

I have always found EXCEL very good at producing one off batch files to do
tasks like the one you want, You can usually export a list of users then
create an EXCEL formula to make the command line you. Copy the formula down
the column and cut and paste into a text file which you can rename to a .CMD
or .BAT file - test on a limited group first.

Hank Eisenstein said:
I've never been good a scripts or batch files. Something we tried was

for /f %d in ("user profiles") do for /d %i IN (\\newsvr\%d$\*) DO subinacl
/subdirectories \\newsvr\%d$\%i\*.* /setowner=domname\%i && xcacls
\\newsvr\%d$\%i\*.* /t /g domname\%i:f

which didn't work very well at all. I'm unclear on exactly what it's doing,
because when we ran it on a test group, it wasn't pretty.
-Hank

Dmitry Korolyov said:
Do you know about a shell built-in "for" command?
If you do, you should be able to perform the task. First, obtain a list of
usernames in a text file (dir /b >userlist.txt is a possibility). Then, use
that text file as list source for the "for" command and perform the commands
you need to transfer data in one big batch.

--
Dmitry Korolyov
(e-mail address removed)
To e-mail me, remove "nospamformorons"
from the address.


Hank Eisenstein Google said:
We are getting ready to migrate from an NT4 domain to an AD domain,
and part of that process requires that I move user shares around. I
have two directories, \svr\user$, and \svr\profile$. I need to move
these folders and all their contents to \newsvr\user$ and
newsvr\profile$. I took ownership, granted myself full control over
all the files, and copied them, using these commands:

subinacl /subdirectories \\svr\user$\*.* /setowner="domname\domain
admins"

xcacls \\svr\user$\*.* /t /e /g "domname\domain admins":f

xcopy \\svr\user$\*.* \\newsvr\user$\*.* /e/h/k/o/i

Now the problem I have is reassigning the appropriate ownership and
permissions to each user folder. I also need to assign the
permissions to the %username% folder. Doing them one at a time, I've
needed to do this:

subinacl /subdirectories \\newsvr\user$\[username]
/setowner="domname\[username]"

subinacl /subdirectories \\newsvr\user$\[username]\*.*
/setowner="domname\[username]"

As you can imagine, this is incredibly tedious. Is there a way to do
this automatically for all users in a certain directory?

Thanks for your assistance.
-Hank
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top