Information générale
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
>>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
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement