Link to home
Start Free TrialLog in
Avatar of mcs26
mcs26

asked on

MS DOS BATCH FTP File Date Help

Hi,

I have some code (at the bottom of post) however I cannot seem to use the mget command to return all files with the name containing BGCO, any ideas would be great?

Thanks

Mark

@echo off
(echo open data.ftse.com
echo user username password
echo prompt n 
echo cd data
echo cd gilts
echo cd gilts_constituents 
echo mget BGCO*csv "G:\Shared\Fixed Income\Sovereign\Mark\FTP\BGCO.csv" overwrite  
echo quit
) | ftp -n -i

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of woolmilkporc
woolmilkporc
Flag of Germany 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
mcs26

ASKER

Hi again,

No I only just remebered the file name changes everyday so I thought I would try to use mget but could not it get it work. I have just tried the below I taking I'm still doing something wrong?

thanks

Mark

@echo off
(echo open data.ftse.com
echo user username password
echo prompt n
echo cd data
echo cd gilts
echo cd gilts_constituents
echo mget *BGCO*.csv
echo quit
) | ftp -n -i
OK,
if there are actually any files in the remote directory data/gilts/gilts_constituents matching *BCGO*.csv
and if you're allowed to write to your current local directory all should be fine.
Avatar of mcs26

ASKER

yeah the directory is fine and I am able to write to my local directory.
in the dos screen it says "mget BGCO1406.csv?"

But it does not copy the file?
That's the usual interactive prompt - and this should not happen with "-i" !
It's due to the line "prompt n" in your script.
"-i" in "ftp -i ..." turns prompting off, and "prompt n" turns it on again... Silly but true!
So either remove "prompt n" or omit the "-i" flag of ftp.
Avatar of mcs26

ASKER

Bingo! Great thanks thats solved it! I have one question left which I think is pretty straight forward but as you can probably tell I know nothing about DOS! I'll start a new question so if you want you can get some more point!

thanks

Mark