Save file to specific folder with curl command

后端 未结 4 1980
北荒
北荒 2020-12-07 07:56

In a shell script, I want to download a file from some URL and save it to a specific folder. What is the specific CLI flag I should use to download files to a specific folde

4条回答
  •  无人及你
    2020-12-07 08:39

    curl doesn't have an option to that (without also specifying the filename), but wget does. The directory can be relative or absolute. Also, the directory will automatically be created if it doesn't exist.

    wget -P relative/dir "$url"
    
    wget -P /absolute/dir "$url"
    

提交回复
热议问题