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.

  • 1
    scp should warn you about any non-existent directory on the destination..didn't you get any such warning ? – heemayl Jul 26 '15 at 18:06
  • @heemayl I didn't get any warning – user568021 Jul 27 '15 at 4:40
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!

  • damn.. i really messed this up :) – user568021 Jul 26 '15 at 20:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.