Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This really is an incredibly bad way to do this. You can't just treat folders on a remote FTP site as local folders.</p> <p>You really should be using InetCtrls.Inet.1</p> <p>Here's an example I lifted from somewhere else that does not do what you want, but contains all the parts you need - you need to pick it apart to suit your needs.</p> <pre><code>'Option Explicit 'const progname="FTP upload script by Richard Finegold" 'const url = "ftp://ftp.myftpsite.com" 'const rdir = "mydir" 'const user = "anonymous" 'const pass = "myname@mymailsite.com" 'This is an example of ftp'ing without calling the external "FTP" command 'It uses InetCtrls.Inet.1 instead 'Included is a "hint" for simple downloading 'Sources: 'http://msdn.microsoft.com/library/partbook/ipwvb5/loggingontoftpserver.htm 'http://msdn.microsoft.com/library/partbook/egvb6/addinginternettransfercontrol.htm 'http://cwashington.netreach.net/ - search on "ftp" - inspiration only! 'Insist on arguments dim objArgs Set objArgs = Wscript.Arguments If 0=objArgs.Count Then MsgBox "No files selected for operation!", vbOkOnly + vbCritical, progname WScript.Quit End If 'Force console mode - csforce.vbs (with some reorganization for efficiency) dim i if right(ucase(wscript.FullName),11)="WSCRIPT.EXE" then dim args, y For i = 0 to objArgs.Count - 1 args = args + " " + objArgs(i) Next Set y = WScript.CreateObject("WScript.Shell") y.Run "cscript.exe " &amp; wscript.ScriptFullName + " " + args, 1 wscript.quit end if 'Do actual work dim fso, ftpo set fso = WScript.CreateObject("Scripting.FileSystemObject") set ftpo = WScript.CreateObject("InetCtls.Inet.1") 'Msinet.ocx ftpo.URL = url ftpo.UserName = user ftpo.Password = pass WScript.Echo "Connecting..." ftpo.Execute , "CD " &amp; rdir do ' WScript.Echo "." WScript.Sleep 100 'This can take a while loop while ftpo.StillExecuting for i = 0 to objArgs.Count - 1 dim sLFile sLFile = objArgs(i) if (fso.FileExists(sLFile)) then WScript.Echo "Uploading " &amp; sLFile &amp; " as " &amp; FSO.GetFileName(sLFile) &amp; " " ftpo.Execute , "Put " &amp; sLFile &amp; " " &amp; FSO.GetFileName(sLFile) 'ftpo.Execute , "Get " &amp; sRemoteFile &amp; " C:\" &amp; sLFile do 'WScript.Echo "." WScript.Sleep 100 'This can take a while loop while ftpo.StillExecuting else MsgBox Chr(34) &amp; sLFile &amp; Chr(34) &amp; " does not exist!", _ vbOkOnly, progname end if next WScript.Echo "Closing" ftpo.Execute , "Close" WScript.Echo "Done!" </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload