VB Script to copy and paste folder from network drive

Dear All

            I'm looking for a vbs that can help to copy Folder from one network drive to another location by using task schedule manager, below is the one i found from internet, but only workable for copying files, not a folder, do any one know which vb script that can copy folder as well ? thanks

Who is Participating?
Michael PfisterConnect With a Mentor Commented:
Why use a VBScript?
Use robocopy

Robocopy "\\\Upload from WP" "\\\...." /S /NP /R:1 /W:1 /LOG+:Logfile.log

Open in new window

Add /MOVE to move files instead of copying

would copy source to target with subfolders (/S). It will save a log file you can check for problems/errors.
If its unable to copy a file it will retry it once (/R:1) after waiting 1 second (/W:1)
Fabrice LambertFabrice LambertCommented:

The FSO object provide a MoveFolder member function:
Sub MoveFolder()
    Const source = "c:\........"
    Const target = "c:\..............."

    Dim fso
    Set fso = createObject("Scripting.FileSystemObject")
    fso.MoveFolder source, target
    Set fso = Nothing
End Sub

Open in new window

piaakitAuthor Commented:
The robocopy can do a move and paste and after the moved it will empty the source files ?
Michael PfisterCommented:
Robocopy /MOVE will delete each source file after copying it. SImilar to WIndows epxlorer or VBScript MoveFile/MoveFolder
piaakitAuthor Commented:
the robycopy work well
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.