473,386 Members | 1,819 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How to download a file with string in name using perl

Srijith B
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
Expand|Select|Wrap|Line Numbers
  1.  
  2. #!/usr/bin/perl 
  3.  
  4. use LWP::Simple; 
  5.  
  6. #-- fetch the zip and save it as perlhowto.zip 
  7. my $status = getstore("http://star.mywebsite/CTP-LATEST-4.4.4.37.iso", "CVP-LATEST-5.3.0.37.iso"); 
  8.  
  9. if ( is_success($status) ) 
  10. print "file downloaded correctly\n"; 
  11. else 
  12. print "error downloading file: $status\n"; 
  13. }
  14.  
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.
Jul 21 '11 #1
3 2210
miller
1,089 Expert 1GB
1) Use LWP to download the webpage that actually links to the file.
2) Parse that file to determine the current resource version
3) Download that file if it's different from the previously downloaded resource.

- Miller
Jul 23 '11 #2
HI miller , you said
"Parse that file to determine the current resource version"

Is it possible to determine the time stamp of that page instead determining the resource version ?
Jul 23 '11 #3
RonB
589 Expert Mod 512MB
Use the head function in LWP::Simple to retrieve the modified timestamp.
Jul 24 '11 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: harshan | last post by:
Hi I am trying to read required worksheet from excel file using perl with module spreadsheet::parseexcel and spreadsheet::writeexcel but I am unable to read it, the error I am getting is...
2
by: kelly | last post by:
Hi, I don't have a code to show you, what I need are references or algorithms so that I'm in a right track. By the way, thanks for introducing me the array or arrays. Now I can continue my...
1
by: Kriston Scott | last post by:
I would like to know how to sort the rows in an Excel file, using Perl.
2
by: prakharv | last post by:
Hi All, I would like to upload a image file from my web page to the server using perl scripting. Please, if any one knows regarding this or has the source code for the same, please help me...
3
by: sainiamit25 | last post by:
Hi, I am trying to set up environment for XML parsing using perl. I downloaded XML::Simple and installed it too. When i try to run my program, it says, you need to install parser. When i try to...
3
by: cypherkro | last post by:
Hi I have a requirement to automatically download a file using a WebBrowser control without having the "Download File" pop up windows display. I cannot use Webclient!! I am using VS2005, .net2...
1
by: prashantkuppa | last post by:
please help me anyone, here i am struck up with extracting check box status from pdf file using perl please give anybody some suggestions its urgent thanks prashant
3
crazy4perl
by: crazy4perl | last post by:
Hi All, I have some doubt related to xml. Actually I want to update a file which is in some format. So I am converting that file using Tap3edit perl module in a hash. Now I m trying to create a...
3
by: rabtree | last post by:
Hi All, I have to two xls file named test1.xls and test2.xls In test1.xls sheet contain 3 colunm 1.Sr.No 2.Case Name 3.Validation case
1
by: msxi | last post by:
Hi, I have s sed script that removes the following lines from a db dump file. I would like to remove these lines using perl. Could anybody assist? /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.