如何将图像卷曲到特定 folder/directory

How to curl images to specific folder/directory

我正在使用此代码:

xargs -n 1 curl -O < urls.txt

从文本文件下载所有图片 url。

所有图像正在下载到主目录。

如何指定 folder/directory 下载到?

curl 没有特定选项来指定 -O 的下载目录。标准的解决方法是先将命令行设置为 cd 到您选择将文件下载到的目录。

也许是这样的:

#!bin/sh
# figure out where we are
pwd=`pwd`

# go to the download directory
cd /tmp/my-downloads

# Download into the right dir, find the URL file in the original dir
xargs -n 1 curl -O < $pwd/urls.txt