*Edited to clean up paths 12/13/05 13:45*

I really like this example.

Question?

I know line 6 in the code below is incorrect how do I copy files and sub folders from within a folder to another folder for the same username with out knowing the user name? your example looks like it only copy’s the source folder to all folders.

Code example below.

Example:
Copy: e:\source\netscape7\*.* to e:\%username%\data\netscape7\
Copy: e:\data\%username%\netscape\*.* to e:\data\%username%\data\netscape7\

Also is this an up to data version of the Folder UDF? I searched around for this UDF and this is the only reference I found.


Code:
  
$sourcedir = "e:\source\netscape7"

for each $folder in folderlist('e:\data')
shell 'cmd /c xcopy '+$sourcedir+' e:\data\'+$folder+'\data\netscape /d /e /c /y /h /r'

Shell 'cmd /c xcopy '+$folder+\data\' '+$folder+'\data\netscape7\default user\usedata.slt /d /e /c /y /h /r'

next


; UDF Function FolderList

Function FolderList($folderName,optional $mask)
dim $objDir, $objFld, $objFile, $t, $name
$objDir = CreateObject('Scripting.FileSystemObject')
if @error Exit 1 Endif
$objFld = $objDir.GetFolder($folderName).SubFolders
if @error exit 2 endif ; usually folder not found
For Each $objFile In $objFld
$name=$objFile.name
if ($mask and instr($name,$mask)) or not $mask
$t=$t+'|'+$name
endif
Next
$FolderList=split(substr($t,2),'|')
$objDir = 0
EndFunction



Edited by JTestman (2005-12-13 07:48 PM)