1.

Solve : How to get a batch file to send a .txt file to an ftp server??

Answer»

How to get a batch file to SEND a .txt file to an ftp server?
I have an automatically created .txt file i WANT sent to an ftp server to be acessed from another computer.
How do i do this?see tihs website..

http://search.techrepublic.com.com/search/batch+file+and+ftp.html


heres a sample script to do what you want..

@echo off
SET a=%SystemDrive%\logon.txt
echo username>%a%
echo password>>%a%
echo cd public_html>>%a%
echo Binary>>%a%
echo send "C:\program files\image.jpg>>%a%
disconnect>>%a%
quit>>%a%
ftp -s:%a% ftp.yourserver.com

del /q/f %a% &CLS

on the first line, turn echo off
the second line set the text file into a variable "%a%"
the third line , append your username to a new file "%a%"
the fourth line, append your password
the fifth line, append change directory to public_html or any directory
the sixth line, append the transfer type .. to send photos/executables use 8 bit binary
There is also ascii mode witch is for text, if you send a text file in binary mode the line positions will be messed up , if you send a photo/executable in ascii mode they will be corrupt

the seventh line, send the file C:\program files\image.jpg , notice i added a quotation mark before the C:\ part ,its the same as adding QUOTATIONS AROUND the file path ,you need them to send a file with spaces in it, as shortnames dont work in ftp

the eighth line , append disconnect to a file
the nineth line , append quit ftp.exe to a file
the tenth line ftp -s: is for scripts , so type file variable there
last line , delete the script file and clear the screen



Discussion

No Comment Found