If filesys.directoryexists(args(0)) = False OrElse filesys.directoryexists(args(1)) = False Then Return Nothing
For Each fns As String In filesys.GetFiles(args(0)) 'fileNameSource
Dim fnt As String = args(1) & "\" & filesys.GetName(fns) 'fileNameTarget
If filesys.FileExists(fnt) = False Then
output.show("step1")
filesys.copyfile(fns,fnt)
Else '比较修改时间
Dim fis As new fileinfo(fns) 'fileinfoSource
Dim fist As Date = fis.lastwritetime 'fileinfoSourceTime
Dim fit As new fileinfo(fnt) 'fileinfoTarget
Dim fitt As Date = fit.lastwritetime 'fileinfoTargetTime
If fitt < fist Then
filesys.copyfile(fns,fnt,True)
End If
End If
Next
'子文件夹
For Each fns As String In filesys.GetDirectories(args(0)) 'fileNameSource
Dim fnt As String = args(1) & fns.replace(args(0),"")
If FileSys.DirectoryExists(fnt) = False Then
FileSys.CreateDirectory(fnt)
End If
Functions.Execute("backup", fns,fnt) '递归调用本身
Next
Return Nothing