This is what I have done to get this to scan a directory and to copy source data (using Glenn's copyfiles UDF). Yes there is some blatant homage to his work.

I've got it so that once it is all right I uncomment references to copyfiles2 and comment references to copyfiles (as the end user's won't know what to do with the output).

The error I get is

 Code:
ERROR : Error in expression: this type of array not supported in expressions.!
Script: C:\Stuff\CopyCentral\copycentral.kix
Line  : 57

Which is the line "For each", but this code is used directly in the "dirplus" examples. I am using the latest version of kix32 in this.
 Code:
break on
call @ScriptDir +"\dirlist.udf"
call @ScriptDir +"\dirplus.udf"
;call @ScriptDir +"\copyfiles2.udf"
call @ScriptDir +"\msg.udf"
call @ScriptDir +"\copyfiles.udf"

; Get the source & dest args specified on the command-line

; get the command line as an array - elements 0 & 1 are the kix.exe and the script.kix items
$aCmdLine = GetCommandLine(1)

; scan the array looking for the source arg
$ = AScan($aCmdLine, '--s:', , , 1)		; get SOURCE arg
If $ > 1					; 
  $Source = SubStr($aCmdLine[$], 5)
Else						; arg is required - die if not provided
  'ERROR: Source was not specified!' @CRLF @CRLF
  'Usage: myscript.kix --s:Source_path --d:destination_path' @CRLF
  Quit 1
EndIf

; scan the array looking for the destination arg
$ = AScan($aCmdLine, '--d:', , , 1)		; get destination arg
If $ > 1					; 
  $Dest = SubStr($aCmdLine[$], 5)
Else						; arg is required - die if not provided
  'ERROR: Destination was not specified!' @CRLF @CRLF
  'Usage: myscript.kix --s:Source_path --d:destination_path' @CRLF
  Quit 1
EndIf

$destlist = Dirplus($dest,"/ad")

? "Destination list is " + $destlist
For each $pcc in $destlist
	? "PCC is " + $pcc
	? "Destination Directory is " + $Dest + "\" + $pcc
	;$copycentral = CopyFiles2($Source,$Dest + "\" + $pcc)
	$copycentral = CopyFiles($Source,$Dest + "\" + $pcc,0,1)
Next

exit


Pax