xref: /curl/docs/cmdline-opts/remote-name.md (revision fe9f68fa)
1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Long: remote-name
5Short: O
6Help: Write output to file named as remote file
7Category: important output
8Added: 4.0
9Multi: append
10See-also:
11  - remote-name-all
12  - output-dir
13  - remote-header-name
14Example:
15  - -O https://example.com/filename
16---
17
18# `--remote-name`
19
20Write output to a local file named like the remote file we get. (Only the file
21part of the remote file is used, the path is cut off.)
22
23The file is saved in the current working directory. If you want the file saved
24in a different directory, make sure you change the current working directory
25before invoking curl with this option or use --output-dir.
26
27The remote filename to use for saving is extracted from the given URL, nothing
28else, and if it already exists it is overwritten. If you want the server to be
29able to choose the filename refer to --remote-header-name which can be used in
30addition to this option. If the server chooses a filename and that name
31already exists it is not overwritten.
32
33There is no URL decoding done on the filename. If it has %20 or other URL
34encoded parts of the name, they end up as-is as filename.
35
36You may use this option as many times as the number of URLs you have.
37