scp from remote Linux to local Windows with spaces in local path

  • Try using quotes ' or Double quotes " around complete argument.

    As suggested by @dirkt in comments Quoting the complete path argument for the ssh host should do the work. That makes your command like this :

    scp /home/user.name/file.html '[email protected]:/C:/Users/user.name/test folder/'
    
  • Use escape sequence for space in between name of folder.

    You can use \ (backslash with a space) that is escape sequence for a space. That makes your command like this :

    scp /home/user.name/file.html '[email protected]:/C:/Users/user.name/test\ folder/'
    

    Notice the \ with a space in between test & folder that makes it test\ folder.

  • It maybe the case that you need to escape twice as It is escaped first locally and then on the remote end. In that case you can write like this :

    1. "'complete argument'" inside quotes within double quotes like this :

      "'[email protected]:/C:/Users/user.name/test folder/'"
      

      OR

    2. Escape spaces and quote complete argument like this :

      '[email protected]:/C:/Users/user.name/test\ folder/'
      

      OR

    3. Escape twice directly using escape sequence like this

      [email protected]:/C:/Users/user.name/test\\ folder/
      

Feel free to add-in more details.