Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #20024

Re: python file synchronization

From Dennis Lee Bieber <wlfraed@ix.netcom.com>
Subject Re: python file synchronization
Date 2012-02-08 09:53 -0500
References <24cb8965-9211-4601-b096-4bf482aead18@h6g2000yqk.googlegroups.com> <20120208034025.GA14347@cskk.homeip.net> <CAH3xUCKhxxb77oXVcA+Ld-+G7NnYdBEYHwCheaTU3C06OhRu6g@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.5544.1328712858.27778.python-list@python.org> (permalink)

Show all headers | View raw


On Wed, 8 Feb 2012 08:57:43 +0200, Sherif Shehab Aldin
<silentquote@gmail.com> wrote:

>
>After searching more yesterday, I found that local mv is atomic, so instead
>of creating the lock files, I will copy the new diffs to tmp dir, and after
>the copy is over, mv it to actual diffs dir, that will avoid reading It
>while It's still being copied.
>
	Are your tmp directory and your "diffs" directory on the same
physical volume? If so, "mv" is a rename operation, that only affects
the directory information. If the volumes are different, then "mv"
reverts to a copy/delete file operation.

	To avoid problems in the future (say the "diffs" machine is
reconfigured with an additional drive and "tmp" is now mounted on the
new drive) you might be better off taking part of the suggestion to use
a special file name to indicate an "in-work" file...

diffs.timestamp.part

say, and when ready, just

mv diffs.timestamp.part diffs.timestamp

	This leaves them in the same physical location and directory.
-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
        wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

python file synchronization silentnights <silentquote@gmail.com> - 2012-02-07 01:33 -0800
  Re: python file synchronization Cameron Simpson <cs@zip.com.au> - 2012-02-08 14:40 +1100
  Re: python file synchronization Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-02-08 09:53 -0500

csiph-web