Discussion Locked

FTP Script file

0 helpful
10 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I am trying to automate an FTP transfer using a batch file in win xp. I am having trouble getting my batch file to run the script (which is a .txt file) to automatically log into the FTP server, transfer the files, then quit.

I see that I need to use the following sequence:

-s:filename

in my batch file to run the script. Problem is my batch file cannot find the script file. How do I make the connection?

10 replies

by liame

Use the batch file to set the current directory to the location of the script.

E.G. Script file is call script.txt and located in the root of c:

The Batch file would contain something lines like...
c:
cd\
ftp -s:script.txt ftp.ftpsite.com

by ramanaiahm

Hi How did you came across this situation finall..i am in same problem could u please explain me how can i create a batch file that will call text file for uploading file into the otherer server.

by gppadu

At first u need to create a batch file by using command copycon in dos mode \by storing the file with extension .bat.

by jim.marshall

Yes it would be GREAT to share knowledge with you guys from India so that next week our jobs can be outsourced to you.

RTFM and work it out for yourself.

by gppadu

give your path(i.e.stored directory) of script file in batch files .then run the Batch file with additional options if necessary

by ramanaiahm

Hi,
Please help me out ...
I need to add a log file to the script file so that I can log the status of file after trasfering using FTP.
Since i am novice to this scripts i am asking.
Thanks

by jphillips

In case you are still looking - Store date/time and then script response.

date /t >> upload_log.txt
time /t >> upload_log.txt
ftp -s:"ftp.scr" >> upload_log.txt

the >> tells it to append
Use > to create a new file

by ziskey

You can use the following syntax within a batch file to call the ftp script. For example, you can run a file called getftp.cmd

Within the file you have a line such as

ftp -s:c:\ftp\getfile.scr > c:\ftplog.txt

The "> c:\ftplog.txt" at the end creates a logfile.

The getfile.scr is a script that opens an ftp session and logs in. Just be aware that the password is saved as plain text. The getfile.scr script might look something like this...

open servername
username
password
ascii
get file.txt
quit

You can use any scheduler to call the cmd file.

by eldorel

@echo off

echo Username>> c:\ftp.txt
echo Password>> c:\ftp.txt
echo ascii>> c:\ftp.txt
echo hash>> c:\ftp.txt
echo prompt>> c:\ftp.txt
echo mget *.txt>> c:\ftp.txt
echo bye>> c:\ftp.txt

@echo on

ftp -s:c:\ftp.txt ftp.example.org
dir

del c:\ftp.txt

REM Remeber to replace Username and Password and ftp.example.org with the correct values for your server...

by kettavanking

i'm stuck with the ftpshell script for rollover log file with max size of 20480 bytes. here is my script.
ftpshell -script "backup.fscr" -tslogfile "test.log" -append 20480

i tried to run it, but it is not running. anyone please help me. my advance thanks.

This discussion is closed to new replies.