Recursive copy woes

This is part of the Semicolon&Sons Code Diary - consisting of lessons learned on the job. You're in the unix category.

Last Updated: 2022-05-26

I had a deploy script, run from project root, which executed this command:

$ scp -r ./public $server_ip:/myapp/public

The result was that the files in ./public locally ended up in /myapp/public/public (double public) on the server.

The fix: assume a folder with source folder name will be created on server

$ scp -r ./public $server_ip:/myapp/