Solved

Batch file to upload files to FTP server

Posted on 2004-08-22
6
1,687 Views
Last Modified: 2008-03-06
I need a batch file that would do this:
(I would normaly do this manually in CMD)

open ftp.***.com

User: ***.com
Password: ***

cd htdocs
lcd C:/mysite

mput * except database

quit
0
Comment
Question by:jonnyfb
  • 3
  • 2
6 Comments
 
LVL 3

Expert Comment

by:Stimphy
ID: 11865426
In your batch put something like

ftp -s:ftp.txt
exit

The -s Switch stands for Script
this will load the specified script file for your ftp session

In ftp.txt put your code

open ftp.***.com
***.com
***
cd htdocs
lcd C:/mysite
mput * except database
bye
0
 
LVL 1

Expert Comment

by:fattumsdad
ID: 11866285
Have you considered trying VBScript to do this?  If you'd like to give it a shot, try this:

Option Explicit
Dim objShell, objShell2
Set objShell = CreateObject("WScript.Shell")

objShell.Run "ftp" 'open FTP
Wscript.Sleep 500 'Pause
objShell.SendKeys "open ftp.**.com {ENTER}" 'Make sure you leave the {ENTER} in there...
objShell.SendKeys "USERNAME {ENTER}" 'FTP login name
objShell.SendKeys "PASSWORD {ENTER}" 'FTP password
objShell.SendKeys "cd htdocs" 'Change dir cmd
objShell.SendKeys "lcd c:\MySite"
objShell.SendKeys "mput * except database"
objShell.SendKeys "quit"
Wscript.Sleep 1000
0
 
LVL 1

Author Comment

by:jonnyfb
ID: 11873226
Thankyou Stimphy!

But when I put mput * except database I was wondering if you could explain how to  put all files except ones with the .mdb extention
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 3

Expert Comment

by:Stimphy
ID: 11875462
How many different types of files can exist in this DIR?  My guess is probably not many, so do something like this.

mput *.exe *.zip *.txt

A less efficient way is
mput *
mdelete *.mdb

Regaurds,
Dave
0
 
LVL 1

Author Comment

by:jonnyfb
ID: 11901122
I need some way of saying yes when it prompts me with a ? because at the moment it just says:

mput file.htm? mput file.htm? mput file.htm? mput file.htm? mput file.htm? mput file.htm? mput file.htm? mput file.htm? mput file.htm? mput file.htm? mput file.htm? mput file.htm? mput file.htm? mput file.htm? mput file.htm? mput file.htm? mput file.htm? mput file.htm?

But it doesnt actually put the files! How will I overcome this problem?
0
 
LVL 3

Accepted Solution

by:
Stimphy earned 125 total points
ID: 11901482
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question