Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Subdirectories
Message
 
 
À
23/01/1999 17:44:20
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Divers
Thread ID:
00179419
Message ID:
00182502
Vues:
15
Thank you Dragan:
Your answer solved my problem.
Eduardo

>>Is there a way to copy a directory with all its content (subdirectories with files inclusive) without knowing the names of the subdirectories with code?
>>Eduardo
>
>You can do it from VFP, with extensive use of ADIR() function. Here's the skeleton:
>
>Procedure xcopy
>Lparam pcSourceDir, pcTargetDir
>#define BS "\"
>if Right(pcSourceDir,1)#BS
>   pcSourceDir=pcSourceDir+bs
>endif
>* repeat this for pcTargetDir
>
>Local lnCnt, laFiles[1]
>
>for lnCnt=1 to Adir(laFiles, pcSourceDir+"*.*", "D")
>   lcFile=laFiles[lnCnt, 1]
>   if "D"$ laFiles[lnCnt,5]       && it's a subdirectory
>      if lcFile="."
>         * it's the current or parent directory entry
>      else
>         * recurse into subdirectory
>         =xcopy(pcSourcedir+lcFile, pcTargetDir+lcfile)
>      endif
>   else          && it's a file
>      copy file (pcSourcedir+lcFile)  to (pcTargetDir+lcfile)
>   endif
>endfor
>
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform