Solved

Batch file to upload files to FTP server

Posted on 2004-08-22
6
1,696 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Part One of the two-part Q&A series with MalwareTech.
Progress
Starting up a Project

636 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