0

I am attempting to copy a file from my network drive to all computers on my network but i am running into a few issues. First thing is that im getting this warning:

-------------------------------------------------------------------------------
   ROBOCOPY     ::     Robust File Copy for Windows
-------------------------------------------------------------------------------

Started : Tuesday, June 30, 2020 9:33:31 AM
2020/06/30 09:33:33 ERROR 67 (0x00000043) Getting File System Type of Source \\108wg-fs-05\03 - 
Section Folders\04 - SCM\4 - Backups" UserProfileBackup.ps1 \C$\Users\Public\Desktop \r:1 \w:0\
The network name cannot be found.

Source = \\108wg-fs-05\03 - Section Folders\04 - SCM\4 - Backups" UserProfileBackup.ps1 
\C$\Users\Public\Desktop \r:1 \w:0\
 Dest -

Files : *.*

Options : *.* /DCOPY:DA /COPY:DAT /R:1000000 /W:30

 ------------------------------------------------------------------------------

ERROR : No Destination Directory Specified.

   Simple Usage :: ROBOCOPY source destination /MIR

         source :: Source Directory (drive:\path or \\server\share\path).
    destination :: Destination Dir  (drive:\path or \\server\share\path).
           /MIR :: Mirror a complete directory tree.

For more usage information run ROBOCOPY /?


****  /MIR can DELETE files as well as copy them !

these are the 2 codes im working with this one is meant to copy a startup script to the computers on the network that connects each to the share drive

robocopy "\\108wg-fs-05\03 - Section Folders\04 - SCM\scripts\startupscript.vbs" "\\$cheese\c$\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup" /r:1 /w:0

This one is meant to back up user data

robocopy "\\108wg-fs-05\03 - Section Folders\04 - SCM\4 - Backups\UserProfileBackup.ps1" "\\$cheese\C$\Users\Public\Desktop" /r:1 /w:0

My goal is to get each to beable to pull their respective files from the network drive and both give me the same error. Any fixes?

3
  • what is the name of the server share that you are trying to access? your command uses 03 - Section Folders and that is a rather odd share name ... [grin] you can get the share names thus >>> Get-CimInstance -ClassName Win32_Share -ComputerName $TargetComputerName <<<
    – Lee_Dailey
    Commented Jun 30, 2020 at 14:12
  • Are you starting robocopy via powershell? Robocopy is tricky to start via powershell. And robocopy is designed copy directories, not single files. For single files copy-item should be better
    – Farbkreis
    Commented Jun 30, 2020 at 15:40
  • i guess it doesnt need to be a robocopy, im just modifying old code to become more flexible. idk but maybe a simple copy would work better?\
    – Zizzay
    Commented Jun 30, 2020 at 16:37

1 Answer 1

0

A couple of problems:

  1. You have given Robocopy SOURCE: <a file>
  2. You have not separated your inputs to SOURCE: ... so it is seeing both <src> and <dest> in SOURCE with DESTINATION blank
  3. Robocopy likes single quoted <src> and <dest>

Calling Robocopy within powershell, you need to modify the source + destination to folders only and use single quotes to separate the arguments.

Example below copies 1x file. Alter $src_file to "." for the whole folder

$src = 'C:\LocalPC\FolderWithFile2Sync\coolFile2Sync.csv'
$dest = '\\10.1.1.x\DestFolder\FolderForSyncdFiles'

$dest_dir = (Split-Path $dest.Replace("""","'") -Parent)
$src_dir  = (Split-Path $src.Replace("""","'")  -Parent)
$src_file = (Split-Path $src.Replace("""","'")  -Leaf -Resolve)

robocopy.exe "$src_dir" "$dest_dir" "$src_file" /IS /IT /IM /TBD /MT:1 /R:5 /W:5 /V /NP /LOG+:'C:\LocalPC\log.txt'

#/R:5  — Retry 5 times (you can set various number, default is 1 million).
#/W:5  — Wait for a few seconds before retrying (you can also set another number, the default is 30 seconds).
#/TBD  — Wait for share names To Be Defined (retry error 67).
#/MT:1 — Do multi-threaded copies with n threads (default is 8).

#/IS :: Include Same files.
#/IT :: Include Tweaked files.    
#/IM :: Include Modified files (Includes same files with different times).

#/NP   — No Progress – can’t show percentage copied.
#/V    — Generates verbose output, displaying skipped files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.