gpt4 book ai didi

wget - 如何从特定 Sourceforge 项目下载所有文件?

转载 作者:行者123 更新时间:2023-12-02 06:00:26 24 4
gpt4 key购买 nike

在花了大约一个小时从 sourceforge 下载几乎所有 Msys 软件包之后,我想知道是否有更聪明的方法来做到这一点。是否可以使用 wget 来实现此目的?

最佳答案

我已成功使用此脚本:

https://github.com/SpiritQuaddicted/sourceforge-file-download

供您使用运行:

sourceforge-file-downloader.sh msys 

它应该首先下载所有页面,然后找到页面中的实际链接并下载最终文件。

来自项目描述:

Allows you to download all of a sourceforge project's files. Downloads to the current directory into a directory named like the project. Pass the project's name as first argument, eg ./sourceforge-file-download.sh inkscape to download all of http://sourceforge.net/projects/inkscape/files/

以防万一存储库被删除,我会将其发布在这里,因为它足够短:

#!/bin/sh

project=$1
echo "Downloading $project's files"

# download all the pages on which direct download links are
# be nice, sleep a second
wget -w 1 -np -m -A download http://sourceforge.net/projects/$project/files/

# extract those links
grep -Rh direct-download sourceforge.net/ | grep -Eo '".*" ' | sed 's/"//g' > urllist

# remove temporary files, unless you want to keep them for some reason
rm -r sourceforge.net/

# download each of the extracted URLs, put into $projectname/
while read url; do wget --content-disposition -x -nH --cut-dirs=1 "${url}"; done < urllist

rm urllist

关于wget - 如何从特定 Sourceforge 项目下载所有文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3390379/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com