>oFSO = CREATEOBJECT( "Scripting.FileSystemObject" ) >oFSO.CopyFolder( 'd:\Fred', 'd:\Wilma' ) >>
>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 >ENDIF >>
>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 >ENDFOR >>