0

Is it possible to do backup without closing programs that are opening files for editing?

I would like to do backup without closing programs that are opening files that I am reading or writing. I usually open many text files in emacs in different terminal tabs, and pdf files in pdf editors, for a long period of editing, so I don't want to close the programs for keeping what files and where in them I am working on.

Most of the time I save changes immediately after I make some. But I might miss to save them sometimes. Should I check that manually, or is there some program to do that?

  • unlike windows, there is no error when you backup an open file. closing file; or better unmounting filesystem is a custom that allow a coherent state. so in short you may, but you won't have guarantee about what is backuped. – Archemar Mar 25 '15 at 7:09
  • You can use ^x s (not ^x ^s) to be prompted to save all unsaved buffers in emacs. Besides what everyone is telling you about Unix filesystem semantics (it's no problem reading a file that another process has an open file descriptor for, just see /proc/<pid>/fd for example), the convention for Unix apps is to not actually keep an open file descriptor for a file after loading it into an editor buffer. (e.g. ll /proc/<pid-of-emacs>/fd.) The convention is to remember the mod time from loading, and compare it against the current state in the file when saving, and prompt on external change. – Peter Cordes Mar 25 '15 at 8:12
  • Also, I upvoted the question back to zero. IMHO it's ok to ask questions about things you don't know anything about, as long as it's not too frequent. You're probably not the first person to wonder about this, thanks to the ridiculously terrible design of Windows filesystem semantics. (also, even on Windows, I believe there are system calls you can use to read open files, and backup programs use them.) – Peter Cordes Mar 25 '15 at 8:16

Your Answer

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

Browse other questions tagged or ask your own question.