How do I scp a filename with spaces?

Spaces in directories or filenames are the natural enemy of a Linux system but can of course be escaped with due diligence. There are 3 possibilities that you could try:

  1. scp [remote username]@192.168.1.X:"'/media/remote_username/photos 4/file.jpg'" .
  2. scp [remote username]@192.168.1.X:"/media/remote_username/photos\ 4/file.jpg" .
  3. scp [remote username]@192.168.1.X:/media/remote_username/photos\\\ 4/file.jpg .

All should work but some are syntactically easier to understand than others...

References:

  • How to escape spaces in path during scp copy in linux?