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


1
piaakitAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Fabrice LambertFabrice LambertCommented:
Hi,

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

0
Michael PfisterCommented:
Why use a VBScript?
Use robocopy

I.e.
Robocopy "\\10.154.101.150\Upload from WP" "\\10.141.101.11\...." /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)
HTH
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
piaakitAuthor Commented:
The robocopy can do a move and paste and after the moved it will empty the source files ?
0
Michael PfisterCommented:
Robocopy /MOVE will delete each source file after copying it. SImilar to WIndows epxlorer or VBScript MoveFile/MoveFolder
0
piaakitAuthor Commented:
the robycopy work well
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VB Script

From novice to tech pro — start learning today.