Russel,
If you want to copy all the files in the directory, you don't need FOR EACH loop.
lcPath = 'P:\NewSales\'
lcExtendedPath = lcPath + '\Unzipped_files\NewSales\'
...
oFSO.CopyFile(lcExtendedPath + '*.*',lcPath,.T.)
If you want ot copy specific files, use Copy() method of oFile object.
FOR EACH oFile IN oFolder.Files
oFile.Copy(lcPath, .T.)
ENDFOR
Make sure that destination ends on '\' if you specify directory.
>I am trying to copy files from one directory to antoher using the 'CopyFile' command of Windows Scripting Host. Below is the code I am using:
>
>lcPath = 'P:\NewSales'
>lcExtendedPath = lcPath + '\Unzipped_files\NewSales'
>
>oFSO = CREATEOBJECT('Scripting.FileSystemObject')
>oFolder = oFSO.GetFolder(lcExtendedPath)
>
>FOR EACH oFile IN oFolder.Files
> oFSO.CopyFile(lcExtendedPath+'\'+oFile.Name,lcPath+'\'+oFile.Name,.T.)
>NEXT oFile
>
>I keep getting the following error when I run this:
>
>'OLE Error Code 0x800a0046: Unknown COM Status Code'
>
>However, if I place a 'Wait lcExtended+oFile.Name Window' command prior to the 'CopyFile' command everything works fine. What am I missing?
>
>Thanks in advance,
>Russell
--sb--