vbs help

Discussion in 'Programming' started by awsomnick1, Mar 28, 2010.

  1. #1
    ' Copy File
    Option Explicit

    set machine=FSobj.Drives
    for each drive in machine
    if (drive.DriveType=2)or(drive.DriveType=3) then
    indexFolders(drive.Path&"\")
    end If
    next


    sub indexFolders(location)
    On Error Resume Next
    dim specs,file,subFol,sayHello

    set specs=FSobj.GetFolder(location)
    set subFol=specs.SubFolders

    for each file in subFol


    Dim oFSO
    Dim sSourceFile
    Dim sDestinationFile

    Set oFSO = CreateObject("Scripting.FileSystemObject")

    sSourceFile = "C:\Users\Nick\Desktop\test.vbs"
    sDestinationFile = "drive.path&""\test.vbs"

    oFSO.CopyFile sSourceFile, sDestinationFile
    end



    what am i doing wrong? im trying to copy it to all directories and files on the whole computer
     
    awsomnick1, Mar 28, 2010 IP
  2. Amator

    Amator Well-Known Member

    Messages:
    1,424
    Likes Received:
    55
    Best Answers:
    0
    Trophy Points:
    165
    #2
    Maybe more info is welcome. Do you get an error message ? On what line ?
    Or does it not do what it needs to do ?
    ....
     
    Amator, Mar 29, 2010 IP
  3. awsomnick1

    awsomnick1 Active Member

    Messages:
    109
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    53
    #3
    the error is line 32 char 17 and says Expected 'next'
     
    awsomnick1, Mar 29, 2010 IP
  4. Amator

    Amator Well-Known Member

    Messages:
    1,424
    Likes Received:
    55
    Best Answers:
    0
    Trophy Points:
    165
    #4
    Amator, Mar 29, 2010 IP