Copying contents of a folder via SCP results in `scp: error: unexpected filename: .`
6,158
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
Related videos on Youtube
Author by
finefoot
Updated on September 18, 2022Comments
-
finefoot over 1 year
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?
-
Nasir Riley about 5 yearsWhy not just use
rsync
instead? It does exactly what you're trying to do.
-