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