Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CopyFiles
Message
 
 
To
13/02/2003 09:47:47
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00752663
Message ID:
00752766
Views:
18
This message has been marked as a message which has helped to the initial question of the thread.
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--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform