Link to home
Start Free TrialLog in
Avatar of mcs26
mcs26

asked on

MS DOS FTP BATCH File

Hi,

I have two MS DOS Batch files "FTSE" and "Lehmans" which are in my shared folder at work in G:\Shared\Fixed Income\Sovereign\Mark\Scheduled Tasks. The Lehmans batch file run perfectly. The FTSE file which is pretty much identical does not, I have pasued the DOS screen and see the following error message "Error opening script file txtFTSE.scp."

I have copied the text for both batch files & text files (bottom of post). Like I say the Lehman file works pefectly but the FTSE one does not. I have double checked the password, username & address but cannot find my error.

Any help would be great!

Thanks

My Batch files

FTSE

G:
G:\Shared\Fixed Income\Sovereign\Mark\Scheduled Tasks

ftp -s:txtFTSE.scp data.ftse.com

Lehmans

G:
G:\Shared\Fixed Income\Sovereign\Mark\Scheduled Tasks

ftp -s:txtLehman.scp indexftp.barcap.com

Text Files

FTSE

Username
Password

prompt n

cd data
cd gilts
cd gilts_constituents

get BGCO1406.csv "G:\Shared\Fixed Income\Sovereign\Mark\Scheduled Tasks\BGCO1406.csv" overwrite  

quit

Lehmans

Username
Password

prompt n

cd point
cd download

mget *_TAPLATRI_*_Global_Barcap_HY_Index.csv "G:\Shared\Fixed Income\Sovereign\Mark\FTP\Leh.csv" overwrite

quit
Avatar of woolmilkporc
woolmilkporc
Flag of Germany image

Is the full name of the "FTSE" text file actually " txtFTSE.scp" ?
wmp
Avatar of mcs26
mcs26

ASKER

Hi woolmilkporc,

The full name of the text file is txtFTSE and the other file is called txtLehman. Really cant see a difference between the two!

Thanks
... and the extension ".scp" ?
 
Avatar of mcs26

ASKER

No just txtFTSE. I have just tried to run the code again and changed the batch file to "ftp -s:txtFTSE data.ftse.com" (without the .scp) and the error message jsut said Error opening scripting file txtFTSE.
Yes it does seem to be pointing to the script not being found.  Two suggestions:

1. Start a cmd.exe prompt.  CD /d "G:\Shared\Fixed Income\Sovereign\Mark\Scheduled Tasks"
dir txt*.*

to check the filename is exactly right.

Second option is to use a different technique for the ftp scripts, have a look at the options I have in my page here, in particular the "method 3" version keeping it all in the batch file which simplifies things IMO.

http://scripts.dragon-it.co.uk/links/batch-ftp-scripting
Please double check the filenames!
Maybe you suppressed the displaying of "known" extensions?
The files must be named as they appear in the batch files, literally.
I suspect the file extension is possibly .txt but hidden when you look in explorer...

Steve
ASKER CERTIFIED SOLUTION
Avatar of Steve Knight
Steve Knight
Flag of United Kingdom of Great Britain and Northern Ireland 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
Avatar of mcs26

ASKER

Hi dragon-it,

I have just copied the code above and it kinda works (I ve probably done something wrong). I changed the username to my username but is there a way to stop it asking me for my password as I require this task to run in the morning before I get into work?

Thanks
Avatar of mcs26

ASKER

One other thing I have noticed is after entering my password it says invalid  command and then interactive mode is on but it does retrieve the file.

thanks again
SOLUTION
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
Hmm, are there any special characters in your password such as & ^()%" etc.  If so might be an issue. As long as you put the password on the next line (not the word password followed by password, just the pasword) and make sure there are no spaces at the end of the lines as sometimes EE appends spaces when you copy from the page.,

You could check the script it is making using notepad instead:

(echo open data.ftse.com
echo user Username
echo Password
echo prompt n
echo cd data
echo cd gilts
echo cd gilts_constituents
echo get BGCO1406.csv "G:\Shared\Fixed Income\Sovereign\Mark\Scheduled Tasks\BGCO1406.csv" overwrite
echo quit
) > x.txt
notepad x.txt



 By all means go back to the script in a seperate file way.  From the same dir check the filename or from that dir do notepad txtFTSE.scp and paste in the text of your script.


Steve
Avatar of mcs26

ASKER

Thanks very much guys for your help everything works perfectly now!
No problem.  Did you need the password on the same line as the username then in the end.  Each server I have used requires it on a different line but maybe this one is different?

Steve
Avatar of mcs26

ASKER

Yes dargon I just did the following "echo user Username Password". I have to admit I have no knowledge of MS DOS so did not even know where to start! But thanks again for your help

Mark
I'll make a note of that then for future ref.  thanks Steve