# scp may be this bug?



## sintetic (Oct 19, 2011)

Hello.

I tried to copy a directory with scp: 
	
	



```
scp -P 64000 -r root@server:/home/instruction/ /home/instruction
```
 it placed into /home/instruction/instruction...

Then I tried command 
	
	



```
scp -P 64000 -r root@server:/home/instruction/* /home/instruction
```
 and got the desired result.

If I copy with rsync: 
	
	



```
rsync -avz --rsh='ssh -p64000' root@server:/home/instruction/ /home/instruction
```
 and got the desired result too.

Why is this so? Is that correct?

Why ended slash was ignored?


----------



## SirDice (Oct 19, 2011)

It does exactly what it's supposed to do.

NB. Don't allow root logins over SSH, there's a reason why that's turned off by default.


----------



## sintetic (Oct 19, 2011)

> It does exactly what it's supposed to do.


Please, post link or quotes manual where I'll be able to read about role of scp's ended backslash.


----------



## SirDice (Oct 19, 2011)

Read cp(1) as scp(1) follows it's behavior.


----------



## wblock@ (Oct 19, 2011)

`% man rsync | less -p'trailing slash'`


----------



## phoenix (Oct 19, 2011)

sintetic said:
			
		

> Hello.
> 
> I tried to copy a directory with scp:
> 
> ...



Correct.  You told it to copy the instruction/ folder into the location /home/instruction/.  Think of it in terms of files.  Where would a file called "instrcuction" be copied to if you did `$ cp instruction /home/instruction`  It would put that file into a directory called /home/instruction.

The correct syntax for that command would be:
`$ scp -P 64000 -r root@server:/home/instruction /home/`


----------

