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