referencing a web folder

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • saratchev
    New Member
    • Sep 2006
    • 1

    referencing a web folder

    Hi all

    i write a script to syncronize a web folder with a normal one. I want to copy all the files from the normal folder to the web folder. How can a reference the web folder? I have already attached it and I can copy and make all the stuff from windows explorer.

    my sript:

    option explicit
    on error resume next


    Const share = "\\my_Server\my _share"

    Const att = "W:"

    Const folder = "W:\"

    Const user = "my_Server\my_U ser"

    Const pass = "bla-bla"

    Const webfolder = "???"

    Dim myNetwork

    Set myNetwork = WScript.CreateO bject("WScript. Network")

    ' attach the share
    myNetwork.Remov eNetworkDrive laufwerk ' wenn LW nicht vorhanden, wird der nächste Befehl ausgeführt
    myNetwork.MapNe tworkDrive att, share, False, user, pass


    'copy all the staff from :
    call CopyFolderStruc ture(folder, webordner)

    'detach the share
    myNetwork.Remov eNetworkDrive att



    ' >>>>>>>>>>>>>>> >>>>>>> <<<<<<<<<<<<<<< <<<<<<<<<<<<<<< <<<<<<
    ' copy all the folders an subfolders
    Sub CopyFolderStruc ture(strSource, strDestination)
    on error resume next
    Const OVER_WRITE_FILE S = True
    Dim objDir, objFolder, objFiles, fso
    Set fso = CreateObject("S cripting.FileSy stemObject")
    For Each objFiles In FSO.GetFolder(s trSource).Files
    FSO.CopyFile strSource & "\" & objFiles.Name, strDestination & "\" & objFiles.Name, OVER_WRITE_FILE S
    Next
    'Für Unterverzeichni sse rufe die Unterroutine rekurssiv auf
    For Each objDir In FSO.GetFolder(s trSource).SubFo lders
    If Not FSO.FolderExist s(strDestinatio n & "\" & objDir.Name) Then
    FSO.CreateFolde r(strDestinatio n & "\" & objDir.Name)
    End If
    CopyFolderStruc ture objDir.Path, strDestination & "\" & objDir.Name
    Next
    If err.number <> 0 then
    call setFehler ("Source: " & strSource & ", Dest: " & strDestination)
    End If
    End Sub

    ' handle error messages
    Sub setFehler(myTex t)
    Dim myDummy
    myDummy ="Programm: Copy.vbs" & vbcrlf
    myDummy = myDummy & "Fehlernumm er: " & err.number & vbcrlf
    myDummy = myDummy & "Beschreibu ng: " & err.description & vbcrlf
    myDummy = myDummy & "Parameter: " & vbcrlf & myText
    myShell.logEven t 1, myDummy
    ERR.Clear
    myErrorCount = myErrorCount + 1
    End Sub
Working...