Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Copy an Entire Folder
Message
From
01/10/2011 21:49:35
 
 
To
01/10/2011 09:49:09
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Network:
Windows XP
Miscellaneous
Thread ID:
01525339
Message ID:
01525365
Views:
68
>1. MD (make directory) and RD (remove directory) are ok, but is there a command
>that will let you copy a directory and its files to another drive?
>
>2. Also, is there a way (from within your app), to have a progress bar indicate the
>progress of deleting or copying files from one folder to another?
>
>Could use the help,
>Rich Murillo
CLEAR ALL
SET SAFETY OFF

lcSource = "d:\myprojects\project1"
lcDest = "d:\myprojects\project2"
=CopyFilesInFolder(lcSource, lcDest)

PROCEDURE CopyFilesInFolder(tcSource, tcDest)
  LOCAL ARRAY laFiles[1]
  LOCAL lnFileCount, lnIndex, lcFile
  tcDest = ADDBS(tcDest)
  tcSource = ADDBS(tcSource)
  lnFileCount = ADIR(laFiles, tcSource+"*.*", "D", 1)
  FOR lnIndex = 1 TO lnFileCount
    lcFile = TRIM(laFiles[lnIndex, 1])
    IF (AT("D", laFiles[lnIndex, 5]) > 0)
      IF !INLIST(lcFile, ".", "..")
        =CopyFilesInFolder(tcDest+lcFile, tcSource+lcFile)
      ENDIF
    ELSE
      IF !DIRECTORY(tcDest)
        MKDIR (tcDest)
      ENDIF
      COPY FILE (tcSource+lcFile) TO (tcDest+lcFile)
    ENDIF
  ENDFOR
ENDPROC
Regards,
Ony
Previous
Reply
Map
View

Click here to load this message in the networking platform