none
copy all files in a folder to another folder in vfp

    Question

  • Hi all

    I want to copy all files in a folder to another folder in vfp.

    Please help

    regards

    Thursday, February 16, 2012 4:50 PM

Answers

  • You can do it like this:

    * Assuming the new folder doesn't exist

    MD YourNewFolder

    COPY FILE TheOldFolder\*.* TO YourNewFolder\*.*

    Tamar

    • Proposed as answer by yanyee Friday, February 17, 2012 11:44 AM
    • Marked as answer by Creative_Pro Saturday, February 18, 2012 3:24 AM
    Thursday, February 16, 2012 9:22 PM

All replies

  • Hi,

    you can do this with the scripting hosts file system object:

    FUNCTION CopyFolder as Boolean
    LPARAMETERS vSrcDir as String, vTgtDir as String
       LOCAL oFSO as Object, llOverwrite as Boolean, llReturn as Boolean
       llReturn = .F.
       IF DIRECTORY(m.vSrcDir)
           IF DIRECTORY(JUSTDRIVE(m.vTgtDir))
               m.vSrcDir    = JUSTPATH(ADDBS(m.vSrcDir))
               m.vTgtDir    = JUSTPATH(ADDBS(m.vTgtDir))
               llOverWrite    = .T.
               oFSO        = CREATEOBJECT([Scripting.FileSystemObject])
               oFSO.CopyFolder(m.vSrcDir, m.vTgtDir, llOverwrite)
           ENDIF
       ENDIF
       oFSO = []
       RELEASE oFSO
       IF DIRECTORY(m.vTgtDir)
           llReturn = .T.
       ENDIF
       RETURN llReturn
    ENDFUNC
    


    Gruss / Best regards -Tom 010101100100011001010000011110000101001001101111011000110110101101110011

    Thursday, February 16, 2012 5:45 PM
  • You can do it like this:

    * Assuming the new folder doesn't exist

    MD YourNewFolder

    COPY FILE TheOldFolder\*.* TO YourNewFolder\*.*

    Tamar

    • Proposed as answer by yanyee Friday, February 17, 2012 11:44 AM
    • Marked as answer by Creative_Pro Saturday, February 18, 2012 3:24 AM
    Thursday, February 16, 2012 9:22 PM
  • Hi,

    you can do this with the scripting hosts file system object:


    Gruss / Best regards -Tom 010101100100011001010000011110000101001001101111011000110110101101110011

    Tom, you're doing great in these forums. Please email me: edprice at microsoft.

    Thanks!


    Ed Price (a.k.a User Ed), SQL Server Experience Program Manager (Blog, Twitter, Wiki)

    Tuesday, February 21, 2012 12:26 AM