I was using a script to copy the contents of a folder via SCP, without copying the folder itself. Something like this:

scp -i id_rsa -P "$PORT" -r "$HOST:/folder1/folder2/." "backup"

(I'm not able to use * because I want to include dot files, too.)

This has recently stopped working and I'm getting the following error:

scp: error: unexpected filename: .

I think the cause for this are these changes to SCP from November 2018.

Does this mean I'm no longer able to copy contents of a folder via SCP without copying the folder itself?

  • 3
    Why not just use rsync instead? It does exactly what you're trying to do. May 14, 2019 at 22:05

1 Answer 1


I think your interpretation is correct. It was probably an undocumented feature, removed from the undocumented api (see the web archive of the protocol). One workaround is for you to create a symbolic link in the backup directory before the copy.

ln -s . folder2 

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .