No announcement yet.

Need to Copy a folder to c$

  • Filter
  • Time
  • Show
Clear All
new posts

  • Need to Copy a folder to c$

    I have a folder that has a service in it that needs to run on multiple Servers. I need to copy this folder and all its contents to the c$ share of all my servers. I know how to copy files, but not the whole folder in one move. Can someone help me?

    FOR /F %%i in ServersList.txt do copy myfile.txt \\%%i\c$

    Thats why i use for file copy....

  • #2
    Re: Need to Copy a folder to c$

    Why not simply add a line for making a folder name on the destination server, then bulk copy the files to that folder? The command is 'md' (for make directory). Make your 'For' statement a multi-line command.

    Or use 'xcopy' instead, it gives you subfolder & file options as well.
    MSCA (2003/XP), Security+, CCNA

    ** Remember: credit where credit is due, and reputation points as appropriate **


    • #3
      Re: Need to Copy a folder to c$

      FOR /F "usebackq tokens=*" %%i in ("ServersList.txt") do (
      MKDir "\\%%i\C$\service" & Copy "C:\service\*" "\\%%i\C$\service\"

      or simply,
      XCopy /E "C:\service\*" "\\%%i\C$\service\"

      Or better, use microsoft's robocopy.exe


      This posting is provided "AS IS" with no warranties, and confers no rights.


      ** Remember to give credit where credit's due **
      and leave Reputation Points for meaningful posts