0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【Mac】curlを使用してファイルをダウンロードする方法

Posted at

ファイルをダウンロードする

curlを使用してファイルをダウンロードするには-Oを使用して以下のようにします。

curl -O [URL]

[URL]はダウンロードしたいファイルのURLです。
-Oオプションは、URLの最後の部分をファイル名として使用して保存することを意味します。

例えば、以下のURLから画像ファイルをダウンロードしたいとします。

https://example.com/image.jpg

この場合、ターミナルを開いて次のコマンドを入力します。

curl -O https://example.com/image.jpg

このコマンドを実行すると、カレントディレクトリにimage.jpgという名前でファイルが保存されます。

ダウンロードしたファイルに特定の名前を付けたい場合は、-oオプションを使用します。

curl -o my_image.jpg https://example.com/image.jpg

このコマンドを実行すると、my_image.jpgという名前でファイルが保存されます。

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?