# Ubuntu – Keeping files that are often changed in sync between desktop and laptop

gitlatexsyncubuntu-oneversion control

I'm looking for a way to keep a desktop and a laptop in sync. What I want to keep in sync are some folders, mainly ~/Documents, that are changed often when working on them.

If it matters I can connect to my desktop from anywhere via an URL but my laptop is harder to access since it might be behind NAT and such.

I have been looking at Ubuntu One but it seems to not go well with working on documents written in LaTeX. If I work on a .tex file in the Ubuntu One directory and compile it (with pdflatex) every now and then (as often as every 10 sec when working) it will create several new files including a pdf which are uploaded to Ubuntu One and this seems stupid since it will create continuous upload when working on .tex files. I also usually keep .tex documents version controlled by git and then every commit (which also can happen frequently) will cause upload (by changes in ./.git) so that it happens continuously when working. Another example is editing images that are saved often. What I think would be best is for sync to happen every tenth minute or at the end of every working session (but there might be some other way to handle this?).

I think you do not need to add the generated (PDF, dvi or Postscript) files to the version control system; however it makes sense to copy them to a synced directory or other server. I usually make this sort of things with the make command.

I have a Makefile like this in the directory where the LaTeX files are (indents are tabs, not spaces). See GNU Make Manual.

%.pdf: %.tex
pdflatex  $< pdflatex$<

store_pdf:
cp example*.pdf path/to/synced_directory

scp example*.pdf user@server.name.com:path/to/directory

clean:
rm *.log *.aux *.nav *.vrb *.out *.snm *.toc


If you want to move the files to a synced directory or to a server where you have ssh access, you need to type:

make store_pdf

make example1.pdf

make clean