1

Here's what I did:

  • copied some files from server to my local computer

    scp root@remotemachine:/var/log/nginx/* /home/me/logs

  • deleted the files on the server

The next moment I realized, that I forgot to create the target directory on the local machine (/home/me/logs). Now instead of copied files inside 'logs' I see a file called 'logs' that looks like gzip archive, but file-roller doesn't recognize it as a valid gzip archive.

2
  • 1
    scp should warn you about any non-existent directory on the destination..didn't you get any such warning ?
    – heemayl
    Commented Jul 26, 2015 at 18:06
  • @heemayl I didn't get any warning
    – user568021
    Commented Jul 27, 2015 at 4:40

1 Answer 1

3

In this case scp will copy each source file to /home/me/logs, overwriting /home/me/logs with the contents of each new file.

The result is that /home/me/logs will be a copy of the last source file in the list. All the other source files are lost.

Oops! Regular cp warns and aborts in this case, at least!

1
  • damn.. i really messed this up :)
    – user568021
    Commented Jul 26, 2015 at 20:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .