开发者

MS DOS command or Java code to Copy a file are directory from one drive to Multiple Drives?

开发者 https://www.devze.com 2023-04-08 21:07 出处:网络
I need to copy a directory from one directory to multiple drives (the drives are external storage dev开发者_开发技巧ices). After searching I found the MS DOS command xcopy C:\\ F:\\ /e. This command o

I need to copy a directory from one directory to multiple drives (the drives are external storage dev开发者_开发技巧ices). After searching I found the MS DOS command xcopy C:\ F:\ /e. This command only copies a file to one drive at a time, it doesn't copy to multiple drives. Is there any way to copy a file from one drive to many drives?


A small batch file may help to achieve what you need.

set src=%~1

:Loop
    shift
    set dest=%~1
    if "%dest%"=="" goto :EOF
    xcopy "%src%" "%dest%" /E
goto Loop

save the code to %SystemRoot%\system32\mcopy.bat, then mcopy some-file e: f:\some-directory g:\some-directory-2 h: i: ...

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号