Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Subdirectories
Message
From
23/01/1999 17:44:20
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Miscellaneous
Thread ID:
00179419
Message ID:
00179458
Views:
29
>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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform