On Wed 15 Jun 2016 at 11:13:26 (+0200), Jörg-Volker Peetz wrote: > Leon.37428 wrote on 06/14/16 19:28: > <snip> > > With scp if you plan on using the same file-name, you don't need to > > specify it on the other end. You can simply go right ahead and just type: > > > > scp /home/whatever/file.jpg remote@hostname:"/home/user/Pictures" > > > > Better command > > scp /home/whatever/file.jpg remote@hostname:/home/user/Pictures/ > > because with the ending "/" you state you intend to copy to a directory. If it > doesn't exist you get an error message. Without the "/" at the end of the > remote > path you would rename your file and could even overwrite an existing file name > "Pictures".
Agreed: and there's no -i (as in cp and mv) to protect you from overwriting. I always specify -p otherwise the modification date gets changed even though you've not modified the file. Also useful is -r: scp -pr /home/whatever/ remote@hostname:/home/user/Pictures/ copies everything under whatever/ into the remote directory specified. Cheers, David.