View Single Post
Old 2018-01-17, 19:13   #2
chalsall
If I May
 
chalsall's Avatar
 
"Chris Halsall"
Sep 2002
Barbados

52·373 Posts
Default

Quote:
Originally Posted by storm5510 View Post
What happens if the 'move' command happens at the same instant that the original batch file is open for a write operation?
Under Unix, the "writer(s)" will continue to write to the file under the new name, so long as it is on the same partition/filesystem. I believe the behaviour is the same under Winblows.

To avoid race conditions, it's a good idea to wait for a period of time after moving a file which might have writers before doing any work on the file (such as compressing it). Or, even better, make system calls to determine how many write locks are on the file.
chalsall is offline   Reply With Quote