$origin and $destination are defined in Road Runner and passed to the script.
This piece of code works except for the fact if $origin folder has sub-directories, it won't get copied over to the path defined by $destination.
Code:
$origin = $rr.getinfo("=$origin$")
$destination = $rr.getinfo("=$destination$")
;Get origin info - file or folder
$originarray = StringSplit($origin, "\", 1)
$originarraycount = $originarray[0]
$fileorfolder = StringInStr($originarray[$originarraycount], ".") ;Search string for "." to denote a file. Otherwise, a folder
If $fileorfolder == 0 Then
;Commands to execute if origin is a folder
FileCopy($origin & "\*.*", $destination & $originarray[$originarraycount] & "\", 9)
If FileExists($destination & $originarray[$originarraycount] & "\*.*") Then
$rr.execute("MENU;SUCCESS.skin||SETLABEL;!STATUS;Folder Copied") ;Confirmation skin
Else
$rr.execute("MENU;FAIL.skin||SETLABEL;!STATUS;Copy Failed!") ;Confirmation skin
EndIf
Else
;Commands to execute if origin is a file
;MsgBox(4096,"Drive ", "It's a file")
FileCopy($origin, $destination, 1)
If FileExists($destination & $originarray[$originarraycount]) Then
$rr.execute("MENU;SUCCESS.skin||SETLABEL;!STATUS;File Copied") ;Confirmation skin
Else
$rr.execute("MENU;FAIL.skin||SETLABEL;!STATUS;ERROR! Copy Failed!") ;Confirmation skin
EndIf
EndIf
I've been searching the autoIT help for a few hours now and can't find a solution that will work. The DirMove works, but it deletes the $origin folder.
Any help would be greatly appreciated.