regex - Perl script to list all the files -
I have a website where some download files are stored say that the website contains files
< Code> GTP-UGP-Latest-5.3.0.123.iso GTP-UGP-Latest-5.3.0.127.iso GTP- UGP-latest -5.3.0.132.iso GTP-UG-LATEST-5.3.0.136.iso Pre-UGP- LATEST-5.3.0.124.iso Pre-UGP- LATEST-5.3.0.126.iso Pre-UGP- LateState- 5.3.0.127. ISO Pre-UGP- Latest-5.2.3.0.130.isoThe number of these files is increasing every day.
My ultimate goal is to run the script daily (chronz) to check if there is a new file and download all new files if it has been added.
My argument receives the version number of all files starting with GTP * (say 5.3.0.123) Change it (530123) and then compare to get the largest number and then the previous Check with the downloaded version number which is stored in a local file. If this does not match, we download the file with the largest version number that starts with GTP
and we start with PRE *
I have a bad regular expression in I, please help me on this.
Plea tell me to list all the files in a link and then type it in a local file if I know there is a lot then I think I will take it from there
UPDATED: I will do the following (test):
#! Use / usr / bin / env perl data: Dumper qw (Dumper); File :: Use Globe: 'Globe'; Sub by_version {my $ v_a = $ a; My $ v_b = $ b; $ V_a = ~ s / [^ \ d \.] // g; $ V_b = ~ s / [^ \ d \.] // g; My @Version_A = Partition (/. / /, $ V_a); My @ version_b = partition (/. / /, $ V_b); (My $ i = 0; $ i & lt; scalar (@version_a); $ i ++) {my $ comp = $ version_a [$ i] & lt; = & Gt; $ Version_b [$ i]; Return $ comp ($ comp! = 0); } Return 0; } My @files = bsd_glob ('GTP- UGP-latest - *. ISO'); My @sorted_files = sort by_version @ files; Print dumper (@Sorted_files);
Comments
Post a Comment