Solved

scripting a file/folder copy on windows server

Posted on 2011-03-10
2
301 Views
Last Modified: 2012-05-11
Hi

I need help writing a script to copy a bunch of files.  I am trying to relocate users' my documents folders.

currently they are stored in this location:
"\\servername\username\" (each user is shared individually.  all username folders have the same "documents" label because of the desktop.ini file -very confusing)

i would like to move them all to:
"\\servername\sharename\username\my documents\"

so far i have this running as a loggoff script but it isnt ideal:
robocopy "\\servername\%username%" "\\servername\newshare\%username%\My documents" /mir /sec

what would be the best way to move the files directly on the server without using logon/off scripts?  

thanks for help
0
Comment
Question by:Luxtech
2 Comments
 
LVL 11

Accepted Solution

by:
Tasmant earned 500 total points
ID: 35094477
you could try something like this:
for /F "tokens=*" %i in ('dir /B /A:D') do xcopy "%i\Documents" "D:\newshare\%i\My Documents" /K
 /O /X /Y /E /H
this has to be run on the folder where are stored all the users folders (by example D:\Home)
you should test it before.
0
 
LVL 1

Author Closing Comment

by:Luxtech
ID: 35097416
the script worked in my test setup! not sure what all switches do though, but thanks
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Scenario:  You do full backups to a internal hard drive in either product (SBS or Server 2008).  All goes well for a very long time.  One day, backups begin to fail with a message that the disk is full.  Your disk contains many, many more backups th…
A quick step-by-step overview of installing and configuring Carbonite Server Backup.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

759 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now