LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Download the newest file (https://www.linuxquestions.org/questions/linux-networking-3/download-the-newest-file-4175527058/)

seprob 12-02-2014 01:44 AM

Download the newest file
 
Hello! As I wrote in the topic; how to download (by wget or something) the newest package from given HTTP directory? Package looks like "package_v14.14.0.tar.gz".

astrogeek 12-02-2014 01:50 AM

Code:

wget http;//url.of.site/path/to/package_123.tar.gz
... should do it.

seprob 12-02-2014 03:51 AM

Quote:

Originally Posted by astrogeek (Post 5278025)
Code:

wget http;//url.of.site/path/to/package_123.tar.gz
... should do it.

You dont't understand. I have many files in some directory. I want to write a script which downloads the newest file.

pan64 12-02-2014 03:55 AM

you need to find a way to know the newest, http is not the right way (you may or may not read directory content and you cannot modify it from the client side)

seprob 12-09-2014 06:28 AM

Solution is like this:
Quote:

wget -q -O releases.html http://your.page/directory/
cat releases.html | grep -o your_packages.*your_extension | sed 's/..............$//' | tail -1

pan64 12-09-2014 07:58 AM

wget -O - http://... | grep -o ... | sed ... | tail
but I'm not really sure about the result. Does it always return the latest?

schneidz 12-09-2014 08:09 AM

this web directory is sorted by modified date:
http://schneidz.noip.me/temp/?C=M;O=A

perhaps you can scrape the html to wget the last entry ?

suicidaleggroll 12-09-2014 11:18 AM

As you can see from the above, there is no universal way to do it. You need to tailor your solution to the particular server you're pulling data off of. How do you know one file is newer than another? Are there version numbers? Modification dates? How are things named?

First determine how YOU would identify the newest file, and then write a set of instructions that will allow a script to do the same.


All times are GMT -5. The time now is 09:16 PM.