Results 1 to 2 of 2

Thread: Copy all files

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2009
    Posts
    4

    Copy all files

    I would like to make a vbscript that allows me to copy all the files from one folder to another folder.

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Copy all files

    Try something like
    Code:
    Dim sSourceFolder, sTargetFolder, sFile, oFSO 
    Set oFSO = CreateObject("Scripting.FileSystemObject") 
    sSourceFolder = "c:\Source" 
    sTargetFolder = "c:\Target" 
    For Each sFile In oFSO.GetFolder(sSourceFolder).Files  
        If Not oFSO.FileExists(sTargetFolder & "\" & oFSO.GetFileName(sFile)) Then   
           oFSO.GetFile(sFile).Copy sTargetFolder & "\" & oFSO.GetFileName(sFile),True   
           WScript.Echo "Copying : " & Chr(34) & oFSO.GetFileName(sFile) & Chr(34) & " to " & sTargetFolder  
        End If 
    Next

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width