+ Post New Thread
Results 1 to 3 of 3
Scripts Thread, File copy script in Coding and Web Development; Does anybody have a script that would allow me to do the following quickly. I have my current users My ...
  1. #1
    Quackers's Avatar
    Join Date
    Jan 2006
    Posts
    1,319
    Thank Post
    40
    Thanked 142 Times in 117 Posts
    Rep Power
    53

    File copy script

    Does anybody have a script that would allow me to do the following quickly.

    I have my current users My Documents as their home folder.

    E:\Homes\Users\

    To accomidate Windows 7 and its annoying feature of renaming every home folder to "Documents", i have decided to alter the structure.

    So i will have E:\Homes\%username%\My Documents instead.

    I am also moving it from 1 server to another.

    So i could do with a quick way of moving them. Say i map Y: as the new servers Homes folder during this process.

    E:\Homes\User\ to Y:\Homes\User\My Documents

    Hope that makes sense!

  2. #2

    mac_shinobi's Avatar
    Join Date
    Aug 2005
    Posts
    9,756
    Thank Post
    3,265
    Thanked 1,052 Times in 973 Posts
    Rep Power
    365

    Robocopy ??

    Robocopy

    Microsoft Robocopy GUI For Windows Robocopy

    Along with the robocopy GUI - link to this is on the above page.

    wikipedia page on robocopy - see bottom for table with versions etc

    http://en.wikipedia.org/wiki/Robocopy

  3. #3

    Join Date
    Aug 2005
    Location
    London
    Posts
    3,156
    Thank Post
    115
    Thanked 528 Times in 451 Posts
    Blog Entries
    2
    Rep Power
    124
    Code:
    move e:\homes e:\homestemp
    md e:\homes
    cd e:\homestemp
    for /d %i in (*) do md e:\homes\%i & ren %i "my documents" & move "my documents" e:\homes\%i

    WARNING!!!

    Do make sure you've got a good backup! I've tried this on 2 folders and it works fine but I had just created them and the permissions were "correct" etc etc. If you replace the * in the final line with (say) z* then you'll only move usernames beginning with Z so you get a chance to be confident.

    When you do the md e:\homes step you might want to add a cacls line to set the permissions properly at the top level. The next step shouldn't need permissions changing - you're moving so the permissions will move with them.

    Note that this is written as a set of lines to type at the command prompt. If you put them in a batch file you need to double up the % signs (so %%i instead of %i)

    @mac_shinobi; - I don't think robocopy will work (I did think about it; generally for questions containing the words "move home directories" the answer is "robocopy" but I can't see how to move stuff into a sub-directory of itself hence the convoluted swap I've used. Happy to be proved wrong :-)

  4. Thanks to srochford from:

    Quackers (22nd August 2010)

SHARE:
+ Post New Thread

Similar Threads

  1. Copy Script
    By BJC in forum Scripts
    Replies: 3
    Last Post: 12th February 2010, 12:19 PM
  2. Script to copy folder
    By cookie_monster in forum Windows
    Replies: 5
    Last Post: 7th October 2009, 10:52 AM
  3. Replies: 4
    Last Post: 25th December 2006, 09:15 PM
  4. Replies: 4
    Last Post: 23rd March 2006, 06:27 AM
  5. Replies: 3
    Last Post: 1st March 2006, 12:08 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •