Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to Copy Folder From One Location to Another
Message
De
14/01/2013 15:09:02
 
 
À
14/01/2013 14:55:03
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP
Network:
Windows XP
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01562479
Message ID:
01562486
Vues:
59
>>I wish to copy Directory X located in C:\X to E:\X.
>>There are many sub-directories and files in X.
>>
>>I dont want to use XCOPY or any command that would use DOS feature.
>>
>>Is there any Shell command or any other option.
>
>
>I have done this before in VFP (so I could have a progress bar). I iterated through each directory, calling recursively the same function to add records for each file to a three-column array, which has the (1) source pathname, (2) destination pathname, and (3) description to display in the progress bar of what's being copied.
>
>It was a small block of code. Generically like this:
>
>PUBLIC gaFilesToCopy
>DIMENSION gaFilesToCopy[1, 3]
>* 1 = source pathname
>* 2 = destination pathname
>* 3 = (optional) message to display while copying each one
>lnCount = getCompleteListOfFilesToCopy(lcSourceDirectory, lcDestinationDirectory, .t., "gaFilesToCopy")
>FOR lnI = 2 to ALEN(gaFilesToCopy, 1)
>....* Copy gaFilesToCopy[lnI, 1] to gaFilesToCopy[lnI, 2]
>NEXT
>
>PROCEDURE getCompleteListOfFilesToCopy
>LPARAMETERS tcSrcDir, tcDestDir, tlRecurse, tcArrayName
>LOCAL lnI
>* Get list of files, including directories
>FOR lnI = 1 to ALEN(laDirList, 1)
>....* If it's a directory, append to tcSrcDir and call recurisvely
>....* If it's a file, add it
>NEXT

You need to watch out with arrays -- with a large enough number of files, you can exceed the array size limits of VFP..
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform