General information
Category:
Coding, syntax & commands
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
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only