[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: ssh again



On Wed 15 Jun 2016 at 18:46:01 (+0000), Eduardo M KALINOWSKI wrote:
> On Qua, 15 Jun 2016, Dan Purgert wrote:
> >It is "redundant" in the sense that you move all the way into
> >/home/lisi/pictures/, and then say 'this directory here' (with ./).  BUT
> >as emetib mentions, being an explicit "this directory here" command will
> >ensurethat the system dumps the file(s) into the directory you expect;
> >or fail out in the event that the destination is not a directory (as it
> >would in this case -- pictures are typically stored in
> >"$HOME/*P*ictures".  Remember, capitalization counts).
> 
> OK, but wouldn't /home/user/Pictures/ (note trailing slash) also
> fail in case there isn't a directory Pictures or it's a file? What
> does "/./" add that "/" doesn't do?

I agree; it's a waste of typing.

> >Without the "/./" characters, if you were using something like "scp
> >/path/to/files/*.jpg user@host:/home/user/destination" and "destination"
> >was not already a directory, the system would happily copy every file
> >over the previous one (naming each one 'destination').
> 
> I can't tell what scp does in this case (and can't try right now),
> but regular cp fails with a message saying that 'destination' is not
> a directory. I'd imagine scp does something similar.

That is my experience. But the trailing / is always worthwhile,
if only for the case in which you type, say:

scp -p /path/to/files/*.jpg user@host:/home/user/destination

(where you've forgotten that destination is actually a file)
and *.jpg, unluckily for you, happens to match just one file.
Now you're in trouble.

Cheers,
David.


Reply to: