Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ftp dos command

Status
Not open for further replies.

rozzay

Programmer
Jan 3, 2002
142
0
0
US
Hi I am trying to create a .bat file where I have some dos commands where it could go into the ftp and delete certain html files. It does not seem to work because when it reads the first line ms-dos command prompt pops up and I guess the user is supposed to type in the commands. I need the .bat file function as a scheduled job instead of being interactively used. Here is what I have so far and Thanks in advance!!

echo
ftp
open ftp.domain.com
username
password
cd public_html
del 7510910432.html
del 7510920474.html
pause
bye
 
rozzay,

Here is one way to do it
--------------------------------------------
@ECHO OFF
SETLOCAL

SET ftpsite=ftp.domain.com
SET username=<INSERT User ID>
SET password=<INSERT password>

> ftpscript.ftp ECHO %username%
>> ftpscript.ftp ECHO %password%
>> ftpscript.ftp ECHO cd public_html
>> ftpscript.ftp ECHO del 7510910432.html
>> ftpscript.ftp ECHO del 7510920474.html
>> ftpscript.ftp ECHO bye

FTP -v -s:ftpscript.ftp %ftpsite%

DEL ftpscript.ftp

END LOCAL
----------------------------------------

There are certainly better ways to do this, i.e. hiding user id and password, etc; perhaps some of the more advanced users on this board can post some of them. But, at least this might be able to get you started.

Happy Coding,

Cheskey
 
Thanks..I found one also that works but I want to try your example also to learn more. Question though I am unfamilar with the terms dealing with ftp what does
'ftp -s' mean or in your example what does
FTP -v -s:ftpscript.ftp %ftpsite% do?

Thanks in advance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top