Our Scripting person left the company last month and has been replaced by a scripting noob (me). I am total beginner at this. A took a course a year ago, understood little, and that's about all my vbs experience until now...

My former colleague wrote the script but for some reason it doesn't work (nothing happens). Its supposed to have worked before, I am at a loss to explain why it doesn't now.

The object of the script is very basic. Copy a folder named "ebuns" from a network share and place it in the local directory "c:\Applications\ebuns". The EBUNS folder is about 450MB.

I ran it through a editor (VBSEDIT), and it came back with no errors so I am confused as to why it doesn't work. To my noob eye it looks OK but does anything look off to any of you?

Note: Anything with a xxx was removed by me for confidentiality reasons.

Option Explicit
Dim objFSO, objFolder, strDirectory1, strFileName, strSourcePath, strDestPath
strDirectory1 = "C:\Applications\eBuns"
Const DeleteReadOnly = True       

Set objFSO = CreateObject("Scripting.FileSystemObject")

strSourcePath ="\\xxx\afs_altiris\Scripts\xxx_eBUNS_v4.0_R1\Files\*.*"
strDestPath = "C:\Applications\eBuns"

If objFSO.FolderExists(strDirectory1) Then
objFSO.CopyFile (strSourcePath), (strDestPath)
End If

If any of you VBS gurus could help a colleague I'd sure appreciate it. (and yes Ill get some more practice after this)

4 Comments   [ - ] Hide Comments


  • who are you running this as? do they have rights to the share and rights to the local system directory to copy the files.
  • ...that is to say, which account is running the script? If it's the local System account. for example, it will have no network access.
  • Besides possible access issue, you script will copy files only if folder "C:\Applications\eBuns" will exist. If not it quits and does nothing...
    Have you tested it on machine where folder "C:\Applications\eBuns" was present?
  • Thanks Guys...
    Rad33k Got it. If the C:\Applications\ebuns doesn't exsist the script wont run. I am checking to see why this is clause was added to the script but it at least answers why it didn't work.
Please log in to comment

Answer this question or Comment on this question for clarity


if the destination path  ends with a path separator (\), it is assumed that destination is an existing folder in which to copy matching files. Otherwise, destination is assumed to be the name of a file to create.

so I'd try changing  strDestPath = "C:\Applications\eBuns"   to    strDestPath = "C:\Applications\eBuns\"

I would also clean up strDestPath and strDestPath1   which are different strings that appear to have the same value..

nice MS reference here:
strDestPath = "C:\Applications\eBuns"
Answered 08/11/2014 by: genfoch01
Orange Senior Belt

Please log in to comment