Search code examples
curlcmd

Curl GET on CMD line with spaces in file name


Trying to download a file through CMD line but I have spaces in the filename preventing the download.

curl --request GET -v --user user$site:password https://www.whatever.com/uploads/Filename With Spaces.csv > /users/kanye_west/desktop/FilenameWithSpaces.csv

Tried escaping the spaces with backslash \ already to no avail


Solution

  • Put the URL in quotes.

    curl --request GET -v --user user$site:password "https://www.whatever.com/uploads/Filename With Spaces.csv" > /users/kanye_west/desktop/FilenameWithSpaces.csv
    

    Backslashes would work on Unix, but they aren't used as an escape charater on Windows because they're the original form of directory separator.