ScriptLogic version: KiXtart 4.10
I'm trying to archive files using Robocopy the main reason is the speed and compression it goes at. I did not want to use the copy and delete command in Kix because Robocopy will also remove the folder if no other files or folders are in the structure which is what I want/need.
I have a utility that tells me where deleted user's folder and file are currently and eports that info into a csv file. I need the files to move to a central location. The code works great until it comes accoss spaces in the folder or file names, which is now very common. When shelling out kix now does not pass the correct statements. As you will see I did put in '"' to account for the spaces but now it will not work for any file or folder. I also have the print statement "?" to make sure the code that should be sent to Robocopy is correct.
Can someone please tell me what I'm missing?
Code:
OPEN(1, "DeletedUser.csv", 2) ;Deleted User file created by
;DEBUG "ON"
$X = ReadLine(1)
While @Error=0
$Path = Left($X, InStrRev($X,"\")) ;DOS Path
$Source = '"' + Left($X, InStrRev($X,"\")) + '"' + " " ;Source Path
$Dest = '"' + "C:\Old" + Right($Path, Len($Path) - 2) + '"' + " " ;Destination Path
$File = '"' + Right($X, Len($X) - Len($Path)) + '"' + " " ;File Name
$Opti = " /Z /MOV"
;Show that the info being sent to robocopy is correct
? $Source
? $Dest
? $File
Shell "RoboCopy " + $Source + $Dest + $File + $Opti
$X = ReadLine(1)
Loop
Close(1) ;Close Deleted User file
Errors on test data on my computer. The code is correct in Kix looks the be correct but what is sent to the shell command for robocopy seems to be wrong.:
"C:\Data\Access\AHA\"
"C:\Old\Data\Access\AHA\"
"CISMN.LDB"
----------------------------------------------------------------------
ROBOCOPY v 1.96 : Robust File Copy for Windows NT
----------------------------------------------------------------------
Started : Sat Aug 31 23:23:20 2002
Source : C:\Data\Access\AHA" C:\Old\Data\Access\AHA"\
Dest : C:\Data\Archive\CISMN.LDB\
Files : *.*
Options : *.* /MOV /Z /R:1000000 /W:30
ERROR 123 (0x0000007B) Accessing Source Directory C:\Data\Access\AHA" C:\Old\Data\Access\AHA"\
The filename, directory name, or volume label syntax is incorrect.
Thanks for your help,
Tom
_________________________
Tom Hagen Jr
Power comes from the Mind.