Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Copying a Folder
Message
From
11/10/2002 13:01:24
 
 
To
11/10/2002 12:48:11
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00710410
Message ID:
00710422
Views:
15
>Hi,
>
>I'm having trouble copying a directory from one drive to another. Anyone know the easiest way to do this? I am using VFP6. Thanks!
>

Using the Scripting.FileSystemObject from the WSH makes it trivial:
oFSO = CREATEOBJ('Scripting.FileSystemObject')
oFolder=oFSO.CopyFolder('C:\MyFolderToCopy\','D:\SomeFolderToCopyTo\')
Shell.Application can be used as well with slightly different syntax; it requires that you have a current Shell version rather than the WSH components; you'll have problems getting it to work on older Win95 boxes and some WinNT 4.0 apps that never had IE version 4.0 with the Active Desktop components installed.

You can also use SHFileOperation() to do this; it will perform recursion to copy folder and subfolder content. There's sample code in the Win32API section.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Reply
Map
View

Click here to load this message in the networking platform