SCP command and dealing with spaces.

The SCP (secure copy) command is a useful command when you’re wanting to transfer files from one server to another and is much faster than using FTP. The SCP command works in SSH and can transfer entire folders and it’s content across unlike limitations in FTP command line.

An example scp command is below:

Scp -r user@192.168.1.4:/hdd/Films/Ant-Man /shares/Public/Shared\ Videos/Movies

The above is fine but if there is spaces or obscure symbols in the filename then you may hit some trouble. We can escape these errors by adding in “‘ at the start and end of filename being transferred. Example being:

scp -r user@192.168.1.4:/hdd/Films/”‘Ant-Man (2015)'” /shares/Public/Shared\ Videos/Movies

Remember to change the username and ip address along with path from and to and filenames to match your own argument.

Author: Christopher Buchan

Leave a Reply

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