Solved

scripting a file/folder copy on windows server

Posted on 2011-03-10
2
305 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

This article will show, step by step, how to integrate R code into a R Sweave document
Possible fixes for Windows 7 and Windows Server 2008 updating problem. Solutions mentioned are from Microsoft themselves. I started a case with them from our Microsoft Silver Partner option to open a case and get direct support from Microsoft. If s…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

739 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