【问题标题】:Wget select latest updated directorywget 选择最新更新的目录
【发布时间】:2015-09-19 19:23:12
【问题描述】:

我想使用 wget 从他们的 ftp 获取最新的 libre office。但是,我无法在 BIG 文档中弄清楚他们提到您可以选择最新更新的目录。

这是我要访问的 ftp:

 http://ftp.nluug.nl/office/libreoffice/libreoffice/stable/5.0.1/win/x86_64/

但是,在 libreoffice/stable 之后我不想指定这种类型,但我希望 wget 自动选择最新更新的目录。有人知道怎么做吗?

我想,也许我可以这样做:

http://ftp.nluug.nl/office/libreoffice/libreoffice/stable/*/win/x86_64/

但这没有任何意义。我尝试在 stackoverflow、google 和 wget 文档上找到它,但我没有找到它。如果您能帮助我,我将不胜感激!

如果您有任何问题,请发表评论:)

INFO:我使用批处理文件下载它

【问题讨论】:

    标签: batch-file ftp directory wget directory-structure


    【解决方案1】:

    让我们通过ftp协议访问发行版站点并在调试模式下使用wget获取最后一个目录:

    DIRECTORY; perms 755; size: 66; month: Jul; day: 30; time: 11:36:00 (no yr); 4.4.5
    DIRECTORY; perms 755; size: 66; month: Aug; day: 5; time: 09:59:00 (no yr); 5.0.0
    DIRECTORY; perms 755; size: 66; month: Aug; day: 27; time: 14:06:00 (no yr); 5.0.1
    

    假设 ftp 服务器列表按日期排序,或者未排序,或者主要版本低于 10,我们可以简单地抓住最后一行而不分析日期:

    @echo off
    set "BASEURL=ftp://ftp.nluug.nl/pub/office/libreoffice/libreoffice/stable/"
    for /f "delims=; tokens=1,7" %%a in (
        'wget --debug %BASEURL% --spider 2^>^&1'
    ) do if "%%a"=="DIRECTORY" if not "%%b"=="" (
        rem trim spaces
        for /f "tokens=*" %%c in ("%%b") do set lastversion=%%c
    )
    
    wget %BASEURL%%lastversion%/win/x86_64/*
    pause
    

    【讨论】:

      猜你喜欢
      • 2019-03-02
      • 1970-01-01
      • 1970-01-01
      • 2013-01-12
      • 1970-01-01
      • 1970-01-01
      • 2021-05-16
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多