What do you think about this function to get a result similar to DOS_Copy?it's not safe to delete a file prior to successful copying
You're right, it's the destination file anyway ... maybe it's better to rename it with a temporary name and then delete it after copying or rename it again if the copy fails?What do you think about this function to get a result similar to DOS_Copy?it's not safe to delete a file prior to successful copying
maybe it's better to rename it with a temporary name and then delete it after copying or rename it again if the copy fails?or copy to a temporary name and then if copying successful delete existing file and rename temporary
You can use Shell and get at the old fashioned DOS commands XCOPY comes to mind.Yes, with Shell you can do a lot of things but I think IMHO that in case of error you have less possibility of control.
(command "shell" ..... do your thing)
More recently starting to use Powershell inside windows. Can do stuff like unzip. Lots of help out there.
Have you seen this?Thanks Ron, I will try your version and also LM:copyfolder (Lee Mac).
http://www.theswamp.org/index.php?topic=39415.msg446782#msg446782
(Benchmark '(
(ALE_Files_CopyDir "Z:\\Temp\\testfiles" "Z:\\Temp2\\testfiles" "*.*" 1)
(LM:copyfolder "z:\\temp\\testfiles" "z:\\temp2\\testfiles" T)
(rjp-xcopy "z:\\temp\\testfiles" "*.*" "z:\\temp2\\testfiles" "/d/c/i/k/r/y/q/s")
(ALE_Files_CopyDir "Z:\\Temp\\testfiles" "Z:\\Temp2\\testfiles" "*.*" 1)
(LM:copyfolder "z:\\temp\\testfiles" "z:\\temp2\\testfiles" T)
(rjp-xcopy "z:\\temp\\testfiles" "*.*" "z:\\temp2\\testfiles" "/d/c/i/k/r/y/q/s")
))
--- Benchmark utility: In memory of Michael Puckett ---
Elapsed milliseconds / relative speed for 16 iteration(s):
(RJP-XCOPY "z:\\temp\\testfiles" "*....)......1171 / 30.61 <fastest>
(RJP-XCOPY "z:\\temp\\testfiles" "*....)......1610 / 22.26
(LM:copyfolder "z:\\temp\\tes..........).....16032 / 2.24
(LM:copyfolder "z:\\temp\\tes..........).....16313 / 2.2
(ALE_FILES_COPYDIR "Z:\\Temp\\testfi...).....27437 / 1.31
(ALE_FILES_COPYDIR "Z:\\Temp\\testfi...).....35844 / 1 <slowest>
ALE_FILES_COPYDIR2 >> no vl-file-rename existing files but deleting before copy(Benchmark '(
(ALE_Files_CopyDir2 "Z:\\Temp\\testfiles" "Z:\\Temp2\\testfiles" "*.*" 1)
(rjp-xcopy "z:\\temp\\testfiles" "*.*" "z:\\temp2\\testfiles" "/d/c/i/k/r/y/q/s")
(ALE_Files_CopyDir2 "Z:\\Temp\\testfiles" "Z:\\Temp2\\testfiles" "*.*" 1)
(rjp-xcopy "z:\\temp\\testfiles" "*.*" "z:\\temp2\\testfiles" "/d/c/i/k/r/y/q/s")
))
--- Benchmark utility: In memory of Michael Puckett ---
Elapsed milliseconds / relative speed for 16 iteration(s):
(RJP-XCOPY "z:\\temp\\testfiles" "*....)......1375 / 17.62 <fastest>
(RJP-XCOPY "z:\\temp\\testfiles" "*....)......2250 / 10.77
(ALE_FILES_COPYDIR2 "Z:\\Temp\\testf...).....21671 / 1.12
(ALE_FILES_COPYDIR2 "Z:\\Temp\\testf...).....24234 / 1 <slowest>
(Benchmark '(
(dos_copy "Z:\\Temp\\testfiles\\*.*" "Z:\\Temp2\\testfiles")
(rjp-xcopy "z:\\temp\\testfiles" "*.*" "z:\\temp2\\testfiles" "/d/c/i/k/r/y/q/s")
(dos_copy "Z:\\Temp\\testfiles\\*.*" "Z:\\Temp2\\testfiles")
(rjp-xcopy "z:\\temp\\testfiles" "*.*" "z:\\temp2\\testfiles" "/d/c/i/k/r/y/q/s")
))
--- Benchmark utility: In memory of Michael Puckett ---
Elapsed milliseconds / relative speed for 16 iteration(s):
(RJP-XCOPY "z:\\temp\\testfiles" "*....)......2015 / 12.51 <fastest>
(RJP-XCOPY "z:\\temp\\testfiles" "*....)......2063 / 12.22
(DOS_COPY "Z:\\Temp\\testfiles\\*.*"...).....23531 / 1.07
(DOS_COPY "Z:\\Temp\\testfiles\\*.*"...).....25203 / 1 <slowest>
Might try the robocopy version too :)Yes... robocopy is faster…
http://www.theswamp.org/index.php?topic=39415.msg582702#msg582702
(Benchmark '(
(rjp-robocopy "z:\\temp\\testfiles" "*.*" "z:\\temp2\\testfiles" "/XD")
(rjp-xcopy "z:\\temp\\testfiles" "*.*" "z:\\temp2\\testfiles" "/d/c/i/k/r/y/q/s")
(rjp-robocopy "z:\\temp\\testfiles" "*.*" "z:\\temp2\\testfiles" "/XD")
(rjp-xcopy "z:\\temp\\testfiles" "*.*" "z:\\temp2\\testfiles" "/d/c/i/k/r/y/q/s")
))
--- Benchmark utility: In memory of Michael Puckett ---
Elapsed milliseconds / relative speed for 64 iteration(s):
(RJP-ROBOCOPY "z:\\temp\\testfiles" ...).....1015 / 4.4 <fastest>
(RJP-ROBOCOPY "z:\\temp\\testfiles" ...).....1016 / 4.4
(RJP-XCOPY "z:\\temp\\testfiles" "*....).....4469 / 1
(RJP-XCOPY "z:\\temp\\testfiles" "*....).....4469 / 1 <slowest>
Edit: I have found out I swapped 2 parameters but strangely the program works the same...