General information
Category:
Coding, syntax & commands
>>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..
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only