this code becomes handy.
It doesn't handle recursive directorys,
use RoboCopy for that.
Code: Select all
OpenConsole()
Source.s=ProgramParameter(0)
Destination.s=ProgramParameter(1)
PrintN("SMove by S.Rings,(c) 2009 ")
PrintN("-------------------------------------")
PrintN("secure move " + Source + " To " +Destination )
If Len(Source)=0 Or Len(Destination)=0
PrintN("Paramter ? xmove.exe SourceDirectory DestinationDirectory")
CloseConsole()
End
EndIf
If Right(Source,1)="\"
Source=Left(Source,Len(Source)-1)
EndIf
If Right(Destination,1)="\"
Destination=Left(Destination,Len(Destination)-1)
EndIf
If ExamineDirectory(0, Source, "*.*")
While NextDirectoryEntry(0)
Filename.s= DirectoryEntryName(0)
If Filename<>"." And Filename<>".."
SFile.s=Source + "\" + Filename
DFile.s=Destination+"\"+Filename
PrintN("Copy...." + Filename)
Result=CopyFile(SFile,DFile)
;Debug Result
If Result=1
MD1.s=MD5FileFingerprint(SFile)
MD2.s=MD5FileFingerprint(DFile)
;Debug MD1
;Debug MD2
If MD1=MD2
PrintN("Copy OK, Delete Source..")
DeleteFile (SFile)
EndIf
Else
PrintN("FAILED Copying "+Filename+ " to " +Destination)
EndIf
EndIf
Wend
FinishDirectory(0)
EndIf
CloseConsole()