是否可以使用robocopy合并具有相似数据结构的2个文件夹?例如。我有一个大型音乐数据库,我想将另一个文件夹合并到这个数据库中,但保持数据库中的所有文件都相同,除非存在任何同名文件,否则覆盖它们。结构就像
C:\Music\Queen\
带文件
C:\Music\Queen\We will rock you
C:\Music\Queen\Dont stop me now
我想合并一个结构
D:\Music\Queen\
带文件
D:\Music\Queen\Dont stop me now
D:\Music\Queen\Somebody to love
使用最终结果
C:\Music\Queen\We will rock you
C:\Music\Queen\Dont stop me now //overwritten! Important!
C:\Music\Queen\Somebody to love
我试过了
robocopy "C:\Music\" "D:\Music\" /E /XX /IS
但是这不会覆盖具有相同名称的文件。有什么建议吗?
答案 0 :(得分:1)
请勿使用/XX
。
<强>前强>
Directory of E:\scratch\music2\queen
12/14/2016 03:46 PM <DIR> .
12/14/2016 03:46 PM <DIR> ..
12/14/2016 03:41 PM 340 dontstopmenow.song
12/14/2016 03:41 PM 340 somebodytolove.song
2 File(s) 680 bytes
2 Dir(s) 1,980,783,489,024 bytes free
命令 robocopy music1 music2 /IS /E
-------------------------------------------------------------------------------
ROBOCOPY :: Robust File Copy for Windows
-------------------------------------------------------------------------------
Started : Wednesday, December 14, 2016 4:12:27 PM
Source : E:\scratch\music1\
Dest : E:\scratch\music2\
Files : *.*
Options : *.* /S /E /DCOPY:DA /COPY:DAT /IS /R:1000000 /W:30
------------------------------------------------------------------------------
0 E:\scratch\music1\
2 E:\scratch\music1\queen\
*EXTRA File 18 somebodytolove.song
100% Older 18 dontstopmenow.song
100% New File 18 wewillrockyou.song
------------------------------------------------------------------------------
Total Copied Skipped Mismatch FAILED Extras
Dirs : 2 0 2 0 0 0
Files : 2 2 0 0 0 1
Bytes : 36 36 0 0 0 18
Times : 0:00:00 0:00:00 0:00:00 0:00:00
Speed : 7200 Bytes/sec.
Speed : 0.411 MegaBytes/min.
Ended : Wednesday, December 14, 2016 4:12:27 PM
<强>后强>
Directory of E:\scratch\music2\queen
12/14/2016 03:47 PM <DIR> .
12/14/2016 03:47 PM <DIR> ..
12/14/2016 03:41 PM 340 dontstopmenow.song
12/14/2016 03:41 PM 340 somebodytolove.song
12/14/2016 03:41 PM 340 wewillrockyou.song
3 File(s) 1,020 bytes
2 Dir(s) 1,980,783,489,024 bytes free
文件内容
e:\scratch>type music2\queen\dontstopmenow.song
From music1 folder
e:\scratch>type music2\queen\wewillrockyou.song
From music1 folder
e:\scratch>type music2\queen\somebodytolove.song
From music2 folder