Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Copying a Folder
Message
De
11/10/2002 13:01:24
 
 
À
11/10/2002 12:48:11
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00710410
Message ID:
00710422
Vues:
16
>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform