webForumDet fria alternativet

Drop&cut

2 svar · 237 visningar · startad av Rod

RodMedlem sedan aug. 200246 inlägg
#1

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
Jesper TMedlem sedan nov. 20017 144 inlägg
#2

1. Känns som en ASP-fråga. Jag har meddelat moderator för flytt.
2. V.v. använd [kod]-taggar.

PalleMedlem sedan apr. 20003 174 inlägg
#3

Flyttad från HTML, XHTML & CSS.

mvh Palle
Moderator webForum

272 ms totalt · 3 externa anrop · v20260731065814-full.beb2e261
131 ms — hämta forumlista (db)
127 ms — hämta statistik (db)
133 ms — hämta tråd, inlägg och bilagor (db)