Ronald...
You can pass a second parameter to ADIR that includes the directory whose files you want. For example:
lcSourcePath = Application.DefaultFilePath + "\Reports\Prgs\"
lcDestPath = ALLTRIM(THISFORM.txtM2MPath.Value) + "Reports\Prgs\"
lnFileCount = ADIR(laFiles, lcSourcePATH + "*.*")
You might want to also use the 3rd parameter to limit the items in laFiles to only files (excluding directories, etc.).
Scott
>Hi all,
>
>I want to retrieve a list of all the files in a subdirectory which will then be used as part of a copy routine. Unfortunately, I am unable to set the current directory to the subdirectory before retrieving the list. What I have happening instead is that the file list that is being retrieved is that of the project directory and not the subdirectory. Below is the code that I am using to do this. Help?
>
>lcSourcePath = Application.DefaultFilePath + "\Reports\Prgs\"
>lcDestPath = ALLTRIM(THISFORM.txtM2MPath.Value) + "Reports\Prgs\"
>
>SET PATH TO (lcSourcePath)
>
>lnFileCount = ADIR(laFiles)
>
>FOR lnLoopCount = 1 TO lnFileCount
> COPY FILE (lcSourcePath + laFiles[lnLoopCount,1]) TO (lcDestPath + laFiles[lnLoopCount,1])
>ENDFOR
>
>Thanks in advance,
Scott D. Grabo
Chief Information Officer
Occupational Health Group
First Advantage Corporation