Jump to content

Recommended Posts

Posted

Hi all,hope someone can help with this. Sure it can be done.....

 

I am migrating users home directory contents from Z:\student data\yr11\%username% to h:\student data\yr11\%username%$\

 

instead of going into the origional location and copying stuff to the new root folder (2000+ folders) is there a way of doing this via a utill or script?

 

Basically i want all data from within the origional folder into the new withour copying the origional root folder.

 

hope this makes sence and im not trying to re-invent the wheel !

 

Many thanks in advance

Posted

It's possible I completely misunderstand what you want (and this may be exactly what you are trying NOT to do?) but Robocopy is my weapon of choice when it comes to copying or moving large amounts of data.

 

Put a list of usernames (1 per line) in a file called users.txt then use something like:

 

FOR /f %i IN (users.txt) DO robocopy "Z:\student data\yr11\%i" "h:\student data\yr11\%i" /e /copyall (/move?) (/log:c:\usercopy.txt?)

 

Usual disclaimers.... Do this at your own risk.... Robocopy will happily DELETE things too if you tell it to... I ALWAYS test these scripts with a few test folders first.

  • Thanks 1
Posted
Another vote for robocopy, it is a command line app but will keep security acls on the files and is probably the fastest method avalible. I have used it many, many times for that kind of thing.
Posted (edited)

Another way of doing this, this is the way i do this sort of stuff

 

 

1- Create a folder, best to name it the name you want for the share.

2- Set the correct share permissions (groups recommended) and also NTFS permissions.

3- Copy all the users folders to the folder you just setup.

4- Then in Active Directory highlight all your users for this folder change and then right hand click and properties, tick the box for the home drive, choose the drive letter and then type in your share path and then %username% so yours will be \\student data\yr11\%username%\

This will change all the users folders to the correct permissions for each user.

 

For this to work through you need your current users folders named with their username

 

I have used this method a few times, works great!

Edited by pritchardavid
  • Thanks 1
Posted
Another way of doing this, this is the way i do this sort of stuff

 

 

1- Create a folder, best to name it the name you want for the share.

2- Set the correct share permissions (groups recommended) and also NTFS permissions.

3- Copy all the users folders to the folder you just setup.

4- Then in Active Directory highlight all your users for this folder change and then right hand click and properties, tick the box for the home drive, choose the drive letter and then type in your share path and then %username% so yours will be \\student data\yr11\%username%\

This will change all the users folders to the correct permissions for each user.

 

For this to work through you need your current users folders named with their username

 

I have used this method a few times, works great!

 

Are you sure step 4 works? With server 2008 R2 i wont work if the folder already exists.

Posted

Thanks all.

 

Im looking at the robocopy (gui) route which works as i need (x:\location\yr11/username) > (y:\location\yr11\username$) **contents of original username copied into username$**

 

I just need to get the process a little more automated due to the number of users involved.

 

regarding getting the usernames.txt together do you know of a way of getting this or do i need to manually create the list ?

 

Many thanks and sorry to sound dumb i used to do this kind of stuff all the time but spend my life in group policy and AD now!

Posted
regarding getting the usernames.txt together do you know of a way of getting this or do i need to manually create the list ?

Open a Command Prompt at x:\location\yr11 and do a "DIR >c:\usernames.txt"

Then open the file in Excel as Fixed Width and strip off the first 36 characters.

Then Sort it alphabetically and clean up the handful of extra lines (bytes free, .., etc) that remain.

  • Thanks 1
Posted
Open a Command Prompt at x:\location\yr11 and do a "DIR >c:\usernames.txt"

Then open the file in Excel as Fixed Width and strip off the first 36 characters.

Then Sort it alphabetically and clean up the handful of extra lines (bytes free, .., etc) that remain.

 

or dir /b

  • Thanks 2
Posted
Are you sure step 4 works? With server 2008 R2 i wont work if the folder already exists.

 

Yes it sure does work :)

 

It does come up with an error when you apply it but it does apply the correct permissons

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...