oFSO = CREATEOBJECT( "Scripting.FileSystemObject" ) oFSO.CopyFolder( 'd:\Fred', 'd:\Wilma' )If you need to make some decisions on a file by file basis, you will need to gety all the files in an array using ADIR() and then check the array contents and make your decision about copying there.
LPARAMETERS tcDirectory LOCAL lnDirCnt, laDirs[1], lnCnt, lnLen *** add the current directory to the list lnLen = IIF( TYPE( 'This.aDirectories[ 1 ]' # 'L', ALEN( This.aDirectories ) + 1, 1 ) DIMENSION This.aDirectories[ lnLen ] This.aDirectories [ lnLen ] = tcDirectory *** Now see if we have any directories under the current directory lnDirCnt = ADIR( laDirs, tcDirectory + '*.*', 'D' ) IF lnDirCnt > 1 FOR lnCnt = 1 TO lnDirCnt IF LEFT( laDirs[ lnCnt, 1 ], 1 ) # '.' *** Make sure we have a directory and not a file IF DIRECTORY( tcDirectory + laDirs[ lnCnt, 1 ] ) This.GetChildDirectories( tcDirectory + laDirs[ lnCnt, 1 ] + '\') ENDIF ENDIF ENDFOR ENDIFYou could also add a method called GetFileNames to get all the files in all of the subdirectories like so. This code also allows you to look for files with a single extension, so you could process, for example, only *.txt files if you wanted to.
lnDirCnt = ALEN( This.aDirectories ) FOR lnDir = 1 TO lnDirCnt *** Get all the files in the current direcotry lnFileCnt = ADIR( laFiles, This.aDirectories[ lnDir ] + '*.*' ) *** Loop through the files and add the ones of the correct type to the array *** Column 1 is the file name and column 2 is the directory it is located in FOR lnFile = 1 TO lnFileCnt IF UPPER( ALLTRIM( JUSTEXT( laFiles[ lnFile, 1 ] ) ) ) == lcFileType lnTotalFiles = lnTotalFiles + 1 DIMENSION This.aFileNames[ lnTotalFiles, 2 ] This.aFileNames[ lnTotalFiles, 1 ] = JUSTSTEM( laFiles[ lnFile, 1 ] ) This.aFileNames[ lnTotalFiles, 2 ] = This.aDirectories[ lnDir ] ENDIF ENDFOR ENDFORHTH