File downloading help in perl


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting File downloading help in perl
# 1  
Old 07-21-2011
File downloading help in perl

Im trying to write a perl code to do the following task.

I have a website which is located in a diffirent country.
I want to download a file from that site everyday.
The file name keeps on changing everyday.
say the file name is CTP-latest-5.3.0.37.iso
next day it may change to "CTP-latest-5.3.0.38.iso" or remain same.

I want to download only if the version number (ie. 38 in above example("38.iso") is not the same from last sucessful download or else dont download.

Im very poor in perl, can someone help me on this ?

i tried with
Code:
#!/usr/bin/perl
 
use LWP::Simple;
 
#-- fetch the zip and save it as perlhowto.zip
my $status = getstore("http://star.mywebsite/CTP-LATEST-4.4.4.37.iso", "CVP-LATEST-5.3.0.37.iso");
 
if ( is_success($status) )
{
  print "file downloaded correctly\n";
}
else
{
  print "error downloading file: $status\n";
}


This works fine in downloading the file, But I need to have a check on version number. So I want to download only if the version number has been changed from the version number of previous successful download.

one idea is if we want to download "CTP-LATEST-4.4.4.37.iso" but the file is not available the download fails and we catch the error and we dont increment the value "37" however we are trying with the same value ("37") tommorow. so if ....37.iso is available tommorow then we download and increment the value 37 to 38.iso and store it.


thank you for your time.

Last edited by srijith; 07-21-2011 at 09:35 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

File downloading

I saved to disk using lynx, under ls it shows up but no matter what I have done back comes the statment no such file. How do you erase these ls false readings or open what ls shows? (9 Replies)
Discussion started by: Jackbird
9 Replies

2. Shell Programming and Scripting

How to check if downloading of a file is completed?

Hello All. We are getting one zip file from another server daily. The size of the zip file will be around 4.5 gb that takes time to download completely. I have to process that file furthest once get downloaded completely. I have written one code for that, but i need suggestion whether it is a... (7 Replies)
Discussion started by: looney
7 Replies

3. Shell Programming and Scripting

Downloading file from mainframe to UNIX

Hi All , I need a help regarding file ftp ing from mainframe to unix.Our source file is mainframe file.I need to download the mainframe file to local unix server through unix script.If anyone can help me how we can do it through unix script ,it will be really helpful.Thanks. (7 Replies)
Discussion started by: STCET22
7 Replies

4. UNIX for Dummies Questions & Answers

Crontab Wget, downloading a file to a FTP

Hi there, I've got my own domain, ftp etc.. I'm using cPanel and I want to download a file periodically, every say 24 hours. I've used this command: wget -t inf http : / / www . somesite . com / webcam.jpg ftp : / / i @ MyDomain . net : Password @ ftp . MyDomain . net^no spaces... (24 Replies)
Discussion started by: zYx
24 Replies

5. Windows & DOS: Issues & Discussions

Downloading a file from Website to a Windows Folder

Hi, Is it possible to download a file using Wget or some other command from a Windows machine? Say I want to download something from https server to C:\ABC\abc.xls Any ideas, Thanks. (4 Replies)
Discussion started by: dohko
4 Replies

6. UNIX for Dummies Questions & Answers

Downloading file from web using perl script

Hi experts, I've question in perl, i need to download a text file from the Web and save that content to the server, Is it possible in perl script or i need to do it in the excel. I tried in the excel but the alignment is missing there. Could you please help in find that. Thanks senthilkumar (0 Replies)
Discussion started by: senthil.ak
0 Replies

7. Shell Programming and Scripting

File downloading

Hi, I am newbie in Perl/CGI and I need your help to develop a little script to help me to download some files located in a FTP server via HTTP to a disk. I need to authenticate with username/password via a HTTP page and I can choose the files to download from the web page to my disk. Can... (2 Replies)
Discussion started by: imad77
2 Replies

8. Shell Programming and Scripting

Downloading file from internet

Hi, I need to write a script to download a file (say http: //www.mysite.com/myfile.txt) from the internet (please note that the file is on http not ftp). Please let me know if there is any method other than wget. Thanks, Chetan (4 Replies)
Discussion started by: chetanpc
4 Replies

9. Shell Programming and Scripting

Downloading a csv file automatically

I want to automatically download a CSV file daily which can be found here: London Stock Exchange - Search and the link is named "Click to download covered warrants (100Kb)" on the right hand side. What commands can I use to invoke clicking on this link and initiating the download? And also... (2 Replies)
Discussion started by: figaro
2 Replies

10. UNIX for Dummies Questions & Answers

Downloading Excel File

Hello All, Currently working with CGI scripts in perl which involves a) uploading b) processing c) downloading the file back to the user uploading and processing quite trivial and they are done Third part is kind of being tricky. Excel file in binary format is getting displayed in the... (4 Replies)
Discussion started by: matrixmadhan
4 Replies
Login or Register to Ask a Question