Robocopy cannot use a PS-Drive name longer than one character

0

I have a UNC path mapped to a PSDrive.

PS Plong:\home\Personal\lit> Get-PSDrive

Name           Used (GB)     Free (GB) Provider      Root
----           ---------     --------- --------      ----
...
HKLM                                   Registry      HKEY_LOCAL_MACHINE
P                 384.97        546.54 FileSystem    \\RT-AC66U\files
Plong                                  FileSystem    \\RT-AC66U\files
Variable                               Variable
...

robocopy does not appear to understand a drive name longer than one letter. Appears to work with a one letter drive name. Is there any workaround?

PS Plong:\home\Personal\lit> robocopy Plong:\home\Personal\lit\ Plong:\home\Personal\lit\tt *.sql

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

  Started : Wednesday, July 12, 2017 20:33:57
   Source : \\RT-AC66U\files\home\Personal\lit\Plong:\home\Personal\lit\
     Dest : \\RT-AC66U\files\home\Personal\lit\Plong:\home\Personal\lit\tt\

    Files : *.sql

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

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

2017/07/12 20:33:57 ERROR 161 (0x000000A1) Accessing Source Directory \\RT-AC66U\files\home\Personal\lit\Plong:\home\Personal\lit\
The specified path is invalid.
Waiting 30 seconds...
powershell
robocopy
asked on Stack Overflow Jul 13, 2017 by lit • edited Jul 13, 2017 by Ansgar Wiechers

1 Answer

0

robocopy is not a PowerShell command and doesn't recognize PowerShell paths. You need to map the UNC path to a regular Windows (single-letter) drive for robocopy to be able to work with it.

You already seem to have the path mapped to the drive P: according to your Get-PSDrive output, so simply change your commandline to this:

robocopy P:\home\Personal\lit\ P:\home\Personal\lit\tt *.sql
answered on Stack Overflow Jul 13, 2017 by Ansgar Wiechers

User contributions licensed under CC BY-SA 3.0