0

I may be being ignorant here, but I have been researching for the past 30 minutes and have not found how to do this. I was uploading a bunch of files to my server, and then, prior to them all finishing, I edited one of those files. How can I update the file on the server to the file on my local computer?

Bonus points if you tell me how I can link the file on my local computer to auto update on the server when I connect (if possible of course)

Ryan Saxe
  • 17,123
  • 23
  • 80
  • 128

3 Answers3

2

Just use scp and copy the file back. scp [user]@[address]:/[remotepath]/[remotefile] [localfolder] if you want to copy the file on the server back to your local machine or scp [localfolder]/[filename] [user]@[address]:/[remotepath] in case you want to copy the file again to the server. The elements in [] have to be exchanged with actual paths and or file names. On the remote it has to be the absolute path and on the local machine it can be absolute or relative.More information on scp

This of course means that the destination file will be overwritten.

Maybe rsync would be an option. It is capable to synchronize different folders. rsync can be used to sync folders over the network and is capable to be combined with ssh.

evotion
  • 265
  • 2
  • 13
  • so if I am copying a file rather than folder from my local machine is `[localfolder]` actually going to be `[localfile]`? – Ryan Saxe Aug 12 '14 at 14:03
  • well when I tried that I get the following error: `[path] No such file or directory`. This is clearly because it doesn't know that the path exists since it is on the server and I am on my local host, correct? – Ryan Saxe Aug 12 '14 at 14:05
  • I tried the absolute path on the remote and it still did not work – Ryan Saxe Aug 12 '14 at 14:08
  • `scp [relative-path-file-name] [user]@[address]: [absolute-remote-directory-path]` – Ryan Saxe Aug 12 '14 at 14:13
  • Try something like this: `scp user@address:/path/to/file/filename /path/to/destination/folder` You have to change the names to actual ones. – evotion Aug 12 '14 at 14:16
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/59198/discussion-between-ryan-saxe-and-evotion). – Ryan Saxe Aug 12 '14 at 14:17
0

Have you considered Dropbox or SVN ?

locohamster
  • 117
  • 6
  • This is for a shared server space with multiple people. We are not using either of those and have decided not to. – Ryan Saxe Aug 12 '14 at 13:12
0

I don't know your local computer OS, but if it is Linux or OSX, you can consider LFTP. This is an FTP client which supports SFTP://. This client has the "mirror" functionality. With a single command you can mirror your local files against a server.

Note: what you need is a reverse mirror. in LFTP this is mirror -r

Skiaddict
  • 48
  • 6
  • Okay, that's something to look into. For now is there a way to simply update a file without an additional moduel – Ryan Saxe Aug 12 '14 at 13:19