---
title: "Drop&cut"
type: "forum-thread"
url: "https://www.webforum.nu/amne/asp/105807-drop-cut"
topic: "ASP"
topic_url: "https://www.webforum.nu/amne/asp"
author: "Rod"
published: "2004-06-19T14:07:15.000Z"
updated: "2004-06-28T06:10:25.000Z"
replies: 2
views: 239
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/asp/105807-drop-cut"
---

# Drop&cut

## #1 — Rod, 2004-06-19T14:07Z

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
```

Permalänk: https://www.webforum.nu/p/105807

## #2 — Jesper T, 2004-06-19T20:32Z

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

Permalänk: https://www.webforum.nu/p/1369663

## #3 — Palle, 2004-06-28T06:10Z

Flyttad från HTML, XHTML & CSS.

mvh Palle
Moderator webForum

Permalänk: https://www.webforum.nu/p/1376418

---

Tråden på webben: https://www.webforum.nu/amne/asp/105807-drop-cut
