Link to home
Start Free TrialLog in
Avatar of sandramac
sandramac

asked on

FTP batch file

Hello all,  needing some help, trying to create a bat file to upload all .htm file in my directory C:/users/data to my /public_html directory on my website.  Would appreciate any help to get this done.
ASKER CERTIFIED SOLUTION
Avatar of Alexey Komarov
Alexey Komarov
Flag of Russian Federation image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
What happens when you run it?  

It looks like you used forward slashes for you local folder.

Here is how you do it with Robo-FTP:
WORKINGDIR "c:\users\data"
FTPLOGON "ftp.mysite.com" /user="UserID" /pw="secret"
FTPCD "/public_html"
SENDFILE "*.htm"
FTPLOGOFF
EXIT

Open in new window

I like using FTP without any extra command files, so the above would then look like:
@echo off
(echo open mysite.com
 echo username
 echo password
 echo !:--- FTP commands below here ---
 echo lcd C:/users/data 
 echo cd  public_html/
 echo binary
 echo mput "*.htm"
 echo disconnect
 echo bye
) | ftp -v -i

Open in new window

There methods for not needing to use echo, but they make the script more difficult to understand.
Avatar of Bill Prew
Bill Prew

A great free utility that can do this is NCFTPPUT, take a look, it can do this all with a single line in a BAT file.

http://www.ncftp.com/ncftp/

~bp