0

What I'm trying to do is make my computer automatically update my backup files when I edit my local files. For example. I have a directory of websites I work on. Each site is its own directory. I work on these files locally, but company policy says they need to be located on the server, incase something happens to one of us coders (for example, brain explode from thinking to hard).

What I need to do is somehow link my local directory to the remote directory.

One thing to consider is that the remote directory is not of the same structure as my local directory. The remote directory contains company files with a website folder inside those files, my local directory is just an htdocs folder full of website folders. I need to update the local folder such as
htdocs > cool-website
to the remote server such as

companies > cool-company > website

The remote server is just a hard drive on the network, so its not actually uploading to somewhere on the internet, just making a copy on another drive.

I guess I could use rsync for this? Just run the command per site I want to backup? I'd like to automate this if possible.

One last thing, I can't just store the files on the network server and syslink them to my local drive because I take my computer home to work on stuff and actually need the files to exist on my hard drive.

3
  • rsync should be enough. BTW what do you mean for automate? After each modification you do? After each working day? After each hour? Only when you ask?
    – Hastur
    May 11, 2015 at 19:30
  • after ever time I edit
    – OB7
    May 11, 2015 at 19:51
  • inotify may help you. It can monitor filesystems and notify if any modification occurs. :)
    – B.A.B
    May 12, 2015 at 7:41

1 Answer 1

0

There are a number of things you could do. But if you want to fully automate it, you need a tool for watching for changes on the filing system and triggering the copy shortly thereafter.

I expect there are command line tools that will help but one way to do it would be to write a small tool in Node.JS which has a filing system library that allows you to watch filing systems for changes and make copies. This would copy the whole changed file rather than just the changes as RSYNC would do but that should be fine for web pages.

If you use RSYNC, you still need a way to trigger it on change and I think it might cause interruptions in your workflow.

The other advantage of a custom Node.js app is that you can customise it to cope with the folder refactoring quite easily.

You must log in to answer this question.

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