我有两个目录(dirA
和dirB
),我想将所有文件从dirA
包括子文件夹复制到dirB
其中的文件dirA
替换文件的位置,前提是dirB
这两个文件具有相同的名称(以及相同的子路径),并且fileB.LastWriteTime < fileA.LastWriteTime
,否则,如果 .in 中的文件dirA
不存在于dirB
.
所以,如果我有这些目录:
<directory Name="dirA">
<file Name="file1" LastWriteTime="10:00" />
<file Name="file2" LastWriteTime="11:00" />
<file Name="file7" LastWriteTime="12:00" />
<directory Name="subDir">
<file Name="file3" LastWriteTime="10:00" />
<file Name="file4" LastWriteTime="11:00" />
</directory>
<directory Name="subDir2">
<file Name="file5" LastWriteTime="10:00" />
<file Name="file6" LastWriteTime="11:00" />
</directory>
</directory>
<directory Name="dirB">
<file Name="file1" LastWriteTime="09:00" />
<file Name="file2" LastWriteTime="13:00" />
<directory Name="subDir">
<file Name="file3" LastWriteTime="09:00" />
<file Name="file4" LastWriteTime="12:00" />
</directory>
<directory Name="BsubDir2">
<file Name="file5" LastWriteTime="09:00" />
</directory>
</directory>
更新dirB
后将是:
<directory Name="dirB">
<file Name="file1" LastWriteTime="10:00" />
<file Name="file2" LastWriteTime="13:00" />
<file Name="file7" LastWriteTime="12:00" />
<directory Name="subDir">
<file Name="file3" LastWriteTime="10:00" />
<file Name="file4" LastWriteTime="12:00" />
</directory>
<directory Name="BsubDir2">
<file Name="file5" LastWriteTime="09:00" />
</directory>
<directory Name="subDir2">
<file Name="file5" LastWriteTime="10:00" />
<file Name="file6" LastWriteTime="11:00" />
</directory>
</directory>
谢谢。