Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Subdirectories
Message
De
23/01/1999 17:44:20
Dragan Nedeljkovich
Now officially retired
Zrenjanin, Serbia
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Divers
Thread ID:
00179419
Message ID:
00179458
Vues:
30
>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

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform