Copy folder - vbscript

I just need a simple copy but this example from another EE question is not working for me.
Please help and thank you in advance.

I've tried XCopy examples too, but don't understand the % code.
'******************************************************************************************
if Cpyfiles = "Y" and Cpyfile <> "" then
  Set objFSO = CreateObject("Scripting.FileSystemObject")
  strSubPath = "C:\inetpub\wwwroot\TPTeam\emenus\" & newfile
  If objFSO.FolderExists(strSubPath) = False Then objFSO.CreateFolder(strSubPath)
  Set objShell = CreateObject("WScript.Shell")

  strCommand = "cmd /c xcopy "C:\inetpub\wwwroot\TPTeam\emenus\" & cpyfile & " C:\inetpub\wwwroot\TPTeam\emenus\" & newfile" /E /C"
  objShell.Run strCommand, 0, True


' XCOPY \\%1\cardreader\DCIM v:\Images /e /c /v
'  Dim oFSO: Set oFSO = Server.CreateObject("Scripting.FileSystemObject")
'  fso.CopyFile "<source file>", "<destination file path>", bOverwrite (true/false)

 '  oFSO.CopyFile Server.MapPath("\emenus\" & cpyfile),Server.MapPath("\emenus\" & newfile,false)
  
 
' Set oFSO = Nothing 
end if 
'******************************************************************************************

Open in new window

dcassAsked:
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.

StefanKampCommented:
Simple copy folder to folder (with ifnotexistfolder)


Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
Dim objShell: Set objShell = CreateObject("WScript.Shell")

Dim SourceDir
SourceDir = "C:\Source"
Dim DestDir
DestDir = "C:\Destination"

If objFSO.FolderExists(DestDir) Then
 objFSO.CopyFolder SourceDir, DestDir
Else
 objFSO.CreateFolder(DestDir)
 objFSO.CopyFolder SourceDir, DestDir
End if

SourceDir = "nothing"
DestDir = "nothing"

Open in new window

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
dcassAuthor Commented:
Thanks!
StefanKampCommented:
Glad i could help. Thanks for the points.

Stefan
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.