http://qs1969.pair.com?node_id=51744


in reply to Re: When is it safe to move a file?
in thread When is it safe to move a file?

Thanks repson - I'll give that a go and see how I get on :-)

Pete

  • Comment on Re: Re: When is it safe to move a file?

Replies are listed 'Best First'.
Re: When is it safe to move a file?
by Dominus (Parson) on Jan 14, 2001 at 22:23 UTC
    I'd strongly recomment that you follow kschwab's advice and rename the data file to the same directory before you start to copy or process it. Copying takes time, and you don't want the remote process to start updating the file while your process in in the middle of copying it. Renaming it first will help prevent that.

    Then, after you rename it, check to see if it's still changing, because it's possible that the remote process opened the file just before you renamed it.

    There's still a race condition, but it's much smaller. Proper design would have been for the remote program to never send the same data twice and never use the same filename twice. I also recommend that you find the person who designed this broken protocol and kick them in the ass.