SCP Hates Spaces

Something to remember. scp absolutely hates spaces. With a passion.

Not simply content with escaping spaces with a backslash, e.g. ~/some\ directory/some\ file.jpg, scp demands the backslashes themselves be escaped, resulting in ~/some\\ directory/some\\ file.jpg. But no! This is not enough. We must quote the entire path regardless of the fact that the spaces have already been escaped. Twice.

Now we end up with "~/some\\ directory/some\\ file.jpg". Ridiculous. And just to be clear, it’s not any old quote, it must be a double one. Single quotation marks just don’t cut the mustard, apparently.

It’s times like this I really don’t like the CLI for being so obtuse.

Leave a Reply

Your email address will not be published. Required fields are marked *