Help needed for downloading files from FTP

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
carmine
Posts: 15
Joined: 18 Nov 2013 13:12

Help needed for downloading files from FTP

#1 Post by carmine » 18 Nov 2013 14:21

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

Squashman
Expert
Posts: 4486
Joined: 23 Dec 2011 13:59

Re: Help needed for downloading files from FTP

#2 Post by Squashman » 18 Nov 2013 15:33

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?

carmine
Posts: 15
Joined: 18 Nov 2013 13:12

Re: Help needed for downloading files from FTP

#3 Post by carmine » 18 Nov 2013 19:39

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.

carmine
Posts: 15
Joined: 18 Nov 2013 13:12

Re: Help needed for downloading files from FTP

#4 Post by carmine » 19 Nov 2013 23:10

Hi Squashman,

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

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Help needed for downloading files from FTP

#5 Post by foxidrive » 20 Nov 2013 03:00

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.

carmine
Posts: 15
Joined: 18 Nov 2013 13:12

Re: Help needed for downloading files from FTP

#6 Post by carmine » 20 Nov 2013 03:58

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.

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Help needed for downloading files from FTP

#7 Post by foxidrive » 20 Nov 2013 04:33

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.

shayanjameel08
Posts: 10
Joined: 21 Nov 2013 01:07

Re: Help needed for downloading files from FTP

#8 Post by shayanjameel08 » 23 Nov 2013 05:41

I tried in two ways to download a file from a FTP server. Both did not work, please help

Samir
Posts: 384
Joined: 16 Jul 2013 12:00
Location: HSV
Contact:

Re: Help needed for downloading files from FTP

#9 Post by Samir » 24 Nov 2013 21:43

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.

Post Reply