Hej,
Jag har kodat ett drop and cut script men jag vill att en html fil uppdateras och listar filnamnen och storleken på filerna i en katalog varje gång jag skickar upp något. Hur kan man lösa det?
Min kod
' Check if user really dropped any files,
' if not, don't perform any tasks
Set objArgs = WScript.Arguments
If objArgs.Count() then
' Get windows directory
Set objShell = CreateObject("WScript.Shell")
Set objSysEnv = objShell.Environment("Process")
strWinDir = objSysEnv("WINDIR") & "\"
' Set this to false to disable logging of last file/files sent.
bolEnableLogging = True
' Initiate some variables
Dim objFS, objFile, objDroppedFiles
Dim strServer, strFolder, strUser, strPass, strFilePrefix
strServer = "" ' This is your servername, eg. ftp.mydomain.com
strFolder = "" ' This is the remote folder you want to put your files in
strUser = "" ' This is your username
strPass = "" ' This is password
strFilePrefix = "" ' This is an arbitrary string.
' Create an extra string to enable logging.
If bolEnableLogging Then strLogText = " > " & strWinDir & strFilePrefix & "_log.txt"
' Open an empty file for ftp commands
Set objFS = CreateObject("Scripting.FileSystemObject")
Set objFile = objFS.OpenTextFile(strWinDir & strFilePrefix & "_send.txt", 2, True)
' Write FTP commands to the file
objFile.WriteLine "open " & strServer
objFile.WriteLine strUser
objFile.WriteLine strPass
objFile.WriteLine "cd " & strFolder
objFile.WriteLine "binary"
For Each objDroppedFiles in objArgs
objFile.WriteLine "put """ & objDroppedFiles & """"
Next
objFile.Write "quit"
objFile.Close
Set objFile = Nothing
' Run ftp.exe
objShell.Run "%comspec% /c ftp.exe -i -s:" & strWinDir & strFilePrefix & "_send.txt" & strLogText, 0, True
Set objShell = nothing
' Give a little feedback to the user
WScript.Echo("Uploaded " & objArgs.Count() & " files.")
' Delete the temporary ftp command file.
If objFS.FileExists(strWinDir & strFilePrefix & "_send.txt") = True Then
objFS.DeleteFile strWinDir & strFilePrefix & "_send.txt", True
End if
Set objFS = Nothing
Set objArgs = Nothing
End If