Auto save for .txt files

Bill Davidsen davidsen at tmr.com
Sat Aug 21 20:26:00 UTC 2010


Parshwa Murdia wrote:
> hi,
> Is there any way to have auto save option for .txt files in Fedora.
> Means, if we write something, in some seconds (fixed, e.g., 10 secs)
> that after which it automatically saves the name.txt files while
> creating any new file in Fedora.

Just keep in mind that a file, if open, may be in some state only a mother could 
love. You really have to be selective about saving open files, or eventually you 
will save a file which is not in a useful state.

That said, you can find files modified since the last save and save them with 
whatever means you wish, such as rsync.

This is an example, remember I just made it up:
  touch next-save
  find . -name *.txt -mnewer last-save -mmin +10 >save-list
  rsync -a --files-from=save-list DESTINATION &&
  mv next-save last-save

Save files modified since the previous save, but untouched for ten minutes, 
since that improves your chance that the file is in a useful state, retry until 
the backup succeeds.

Run that as a script every hour or so.

NOTE: this is one of dozens of solutions, unless the data in the files is vastly 
valuable I'd just back them all up once a day. That's me, the cost of backup 
should not be greater than the cost of recreation.

-- 
Bill Davidsen <davidsen at tmr.com>
   "We have more to fear from the bungling of the incompetent than from
the machinations of the wicked."  - from Slashdot


More information about the users mailing list