44
7
I am using the scp command to copy some files to a remote pc, as you do with scp :)
I note that the default behaviour of an scp copy for files is to overwrite any existing files. Now I want to copy a folder so I do basically the same thing:
scp -r <source_path> user@myOtherPc:<dest_path>
Where the parts in <> are my folder paths. However when I run this I get the message "file exists". Is there a way around this? some sort of force over-write?
Thanks, Fodder
Warning: If you use the root user the file will have the root ownership. Not at all a secure idea if at the end there will be some file with read/write/execute attributes set for more than the owner... – Hastur – 2014-07-02T10:45:55.447
2Could you give some examples of path ? I do not perform to reproduce this on my system. Also, have you checked file permissions ? – Levans – 2013-09-23T15:51:07.990
Does it give you any useful info if you use verbose mode?
-v
. Also, are you using absolute or relative path on the destination side? I think if the destination folder already exists, it is going to create the source path inside the destination folder rather than overwrite (testdir/testdir
) – beroe – 2013-09-24T01:47:12.7002
It is strange that you get this. Supposedly scp doesn't have noclobber...
– beroe – 2013-09-24T01:57:52.7271@Levans I did not check the permissions, I have just taken a look and I think you may be right. I deleted everything in the target area and started again using only the "scp" command and using "root" user and I was able to copy the files/folder multiple times :) ... I am not 100% sure what permission issue I had, but now I have a "handle" on the issue I can probably figure it, thanks – code_fodder – 2013-09-24T06:38:39.213
1@beroe Yes, this is what I thought too... it did confuse me, but I think I have made some sort of user error here with the permissions, I am not linux expert yet :( But I will try the verbose-ness next time I have an issue like that to get more info, thanks. Also I have noticed that sometimes you get the "folder-inside-the folder" happening... but that is another issue :o – code_fodder – 2013-09-24T06:41:51.960