batch file - switch xcopy to robocopy -
i using following script. when swap out "move" "robocopy /mov /mt" doesn't work. destination goes 1 level deep , takes name of file destination folder. error below too.
how can use robocopy instead? need multithreading.
error= error 123 (0x0000007b) accessing source directory d:\source\file.tif\ filename, directory name, or volume label syntax incorrect.
@echo off setlocal enabledelayedexpansion set source=d:\source set destination=d:\dest echo gather top 30 files set srccount=0 set srcmax=31 /f "tokens=*" %%a in ('dir /a-d /o-d /b "%source%"\*.*') ( set /a srccount += 1 if !srccount! leq %srcmax% ( move "%source%\%%a" "%destination% ) )
this trying:
@echo off setlocal enabledelayedexpansion set source=d:\source set destination=d:\dest echo gather top 30 files set srccount=0 set srcmax=31 /f "tokens=*" %%a in ('dir /a-d /o-d /b "%source%"\*.*') ( set /a srccount += 1 if !srccount! leq %srcmax% ( robocopy /mov /mt "%source%\%%a" "%destination% ) )
look @ arguments robocopy
:
robocopy /?
------------------------------------------------------------------------------- robocopy :: robust file copy windows ------------------------------------------------------------------------------- started : wed jun 01 18:46:40 2016 usage :: robocopy source destination [file [file]...] [options] source :: source directory (drive:\path or \\server\share\path). destination :: destination dir (drive:\path or \\server\share\path). file :: file(s) copy (names/wildcards: default "*.*").
the first argument source directory, not file. passing file name.
so, instead:
robocopy /mov /mt "%source%" "%destination%" "%%a"
as /mt
option, think threads used copy different files, not different parts of same file.
since call 1 file @ time, don't believe you'll multi-threaded copying.
you'll need gather 30 file names in single string result after substitution single execution of robocopy
this:
robocopy /mov /mt "sourcedir" "destdir" "file1" "file2" "file3" ... "file30"