Page 1 of 1

Help needed for downloading files from FTP

Posted: 18 Nov 2013 14:21
by carmine
Hi,
I never wrote batch files before and now I am having this requirement to automatically download files from FTP Server which are delivered between 8 to 11 p.m.

I being a newbie my expert friends can understand my problem and help me in sorting this.

I did google search for downloading files from FTP which i tried i was successful in login. The login result:
ftp> Connected to 172.xx.x.xx.
open 172.xx.x.xx
220 xyz.xyz.com X2 WS_FTP Server 7.5.1
User (172.xx.x.xx:none)):
331 Enter password
230 User logged in
ftp> disconnect
221 bye
ftp> bye


I tried getting directory listing:
dr-x------- 2 xyz System 14 Nov 02 22:27 Invoice-Centre-0311


My 2 issues.
1. To download files from FTP which has current date (ddmmyyyy) in file name, copy them to
D:\Invoice folder, copy only todays date files from server. (approx. 10 to 12 files each of .img & .xml)

FTP Server directory: Invoice-Centre-0311 File Names: INVOICE_990331_1_18112013_18112013_213818_00.img & INVOICE_990331_1_18112013_18112013_213818.XML

The files are delivered between 8 to 11 p.m.the batch file would require to search rescursively and download them.

2. To verify with FTP Server the files downloaded are perfect in size (approx. 15 to 16 MB the .img files) [very very important]

After downloads gets completed to shut down windows.

I will be using windows task scheduler to run this batch file. Win-7

Any help in this will be most appreciated

Re: Help needed for downloading files from FTP

Posted: 18 Nov 2013 15:33
by Squashman
You want to shutdown the computer when all files are downloaded but without knowing how many files are suppose to be downloaded how can we be sure we have all the files and can shutdown the computer?

Also are you saying that all these files might be in different directories and sub-directories of the ftp server?

Re: Help needed for downloading files from FTP

Posted: 18 Nov 2013 19:39
by carmine
Hi,

Thanks Squashman for response,

Thats
Squashman wrote:You want to shutdown the computer when all files are downloaded but without knowing how many files are suppose to be downloaded how can we be sure we have all the files and can shutdown the computer?


Sorry, i did not mention that as soon as session (all the files are delivered) a flag file of closed session in the form of text file is delivered in the name of 18112013.endos This file means the session is closed and they have delivered all the files. This file 18112013.endos is empty and notifies close of session.

Also are you saying that all these files might be in different directories and sub-directories of the ftp server? ]

Sir, the files are only in the folder : Invoice-Centre-0311 no other directory or sub directories.

Thanks.

Re: Help needed for downloading files from FTP

Posted: 19 Nov 2013 23:10
by carmine
Hi Squashman,

There is no reply from your side, Please if can help me.

Re: Help needed for downloading files from FTP

Posted: 20 Nov 2013 03:00
by foxidrive
carmine wrote:Sir, the files are only in the folder : Invoice-Centre-0311 no other directory or sub directories.


What does this mean then?

the batch file would require to search rescursively and download them.

Re: Help needed for downloading files from FTP

Posted: 20 Nov 2013 03:58
by carmine
foxidrive wrote:


What does this mean then?
the batch file would require to search rescursively and download them.


Thankyou very much foxidrive for response.
I mean to say i have 3 folders under root.
/
folder-1 [upload] (used for uploading files to main office)
folder-2 [reports] (reports and statics, mostly pdf files)
folder-3 [Invoice-Centre-0311] (files to download, type of file .img & .xml only)
e.g. INVOICE_990331_1_18112013_18112013_213818_00.img &
INVOICE_990331_1_18112013_18112013_213818.XML

Foxidrive please forward your support to me in creating this FTP script.

Re: Help needed for downloading files from FTP

Posted: 20 Nov 2013 04:33
by foxidrive
carmine, there are a lot of examples to be found in a google search to automate downloading by FTP.

Please do some research and when you have a specific problem with your script then ask for help regarding that issue.

Pick a script that writes an FTP script file and calls the ftp command with the script file. They are easiest to understand.

Re: Help needed for downloading files from FTP

Posted: 23 Nov 2013 05:41
by shayanjameel08
I tried in two ways to download a file from a FTP server. Both did not work, please help

Re: Help needed for downloading files from FTP

Posted: 24 Nov 2013 21:43
by Samir
shayanjameel08 wrote:I tried in two ways to download a file from a FTP server. Both did not work, please help
Post the batch files you've tried.