19

I'm trying to back up a file via the command

scp /tmp/backup.tar.gz hostname:/home/user/backup.tar.gz

When I run it, the scp progress bar shows up and it looks like its transferring the file, however when I log into the destination server to check the file, the timestamp and filesize haven't changed from the older version, so it looks like scp didn't overwrite the old file at all. It only sees to work when I manually delete the file from the destination server.

I'm running ubuntu, and this is happening on two servers: one cygwin ssh, and one fedora core 3.

Anyone have any idea why this is happening? I thought scp would ONLY overwrite existing files..

Thanks

Noli
  • 341
  • 1
  • 3
  • 8

2 Answers2

10

If I omit the destination file name and only specify directory, then it works:

scp /tmp/backup.tar.gz hostname:/home/user/

I don't understand why, but it might be solution to your problem as well.

Milan Babuškov
  • 1,010
  • 2
  • 15
  • 19
2

Under debian/lenny this is working. Perhaps you use scp -v $localFile $RemoteHost:$RemotePath/$localFile

ThorstenS
  • 3,084
  • 18
  • 21