2

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. – Nasir Riley May 14 at 22:05
  • 1
    @finefoot I think your interpretation is correct. It was probably an undocumented feature, removed from the undocumented api (web archive of protocol). One workaround is for you create a symbolic link ln -s . folder2 in the backup directory before the copy. – meuh May 15 at 17:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.