Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Copy a folder (including all content)
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00687053
Message ID:
00687066
Vues:
21
This message has been marked as the solution to the initial question of the thread.
>Hi.
>
>Take a look:
>
>C:\
>  |
>  +- TEST
>  |  +- Test_a
>  |  |  +- Test_a1.doc
>  |  |  +- Test_a2.xml
>  |  +- Test_b
>  |  +- Test_c
>  +- WINDOWS
>  +- ETC
>
>
>I'd like to copy the folder "TEST" (including all content) for another folder, for example: ANOTHER_TEST...
>
>How can I do it using VFP?
>
>[]s!
Not without recursing the entire tree. However, if either the Scripting.FileSystemObject or the Shell.Application are available, it becomes pretty simple. The main difference between the two is that the former does not display a progess bar, and the latter can.
oFSO = CREATEOBJECT("Scripting.FileSystemObject")
oFSO.CopyFolder(cSource, cDestination, < overwrite >)
The last parameter is an optional Boolean parameter as to whether or not exisiting files should be overwritten. Note that the destination folder must exist or an error will occur.

Now the Shell.Application
oShell = CREATEOBJECT("Shell.Application")
oFolder = oShell.Namespace(cExistingFolder)
oFolder.CopyHere(cSource, nFlags)
The nFlags are a combination of the following constants
#DEFINE FOF_SILENT 0x4 && No progress bar
#DEFINE FOF_RENAMEONCOLLISION 0x8 && Automatically adds "Copy Of"
#DEFINE FOF_NOCONFIRMATION 0x10 && No confirmation before overwrite
#DEFINE FOF_FILESONLY 0x80 && Only files are copied
#DEFINE FOF_SIMPLEPROGRESS 0x100 && File names are not display during copy,
#DEFINE FOF_NOCONFIRMMKDIR 0x200 && No confirmation before folder creation
George

Ubi caritas et amor, deus ibi est
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform