Atomic FileSystem operations

  • Thread starter Thread starter Brian Richards
  • Start date Start date
B

Brian Richards

I have an application that's processing multiple files and doing
copy/move/delete operations on those files to other directories. I'd like to
have code that would ensure for the entire list of files that all operations
succeed. Such that if one file was in use I could rollback or undo all the
previous operations. One method I'm using for locked files is to pinvoke
MoveFileEx but that does not address the problem of atomicity. Is there
anything existing in the framework or 3rd party components that anyone can
point me to that would help implement these file-system "transactions"?
Thanks.
 
Brian said:
I have an application that's processing multiple files and doing
copy/move/delete operations on those files to other directories. I'd
like to have code that would ensure for the entire list of files that
all operations succeed. Such that if one file was in use I could
rollback or undo all the previous operations. One method I'm using
for locked files is to pinvoke MoveFileEx but that does not address
the problem of atomicity. Is there anything existing in the framework
or 3rd party components that anyone can point me to that would help
implement these file-system "transactions"? Thanks.

I guess you can use Win32 LockFile() or LockFileEx() here.

BTW, the Subversion version control system offers a file system based
backend which behaves transactional. Maybe you want to check out their
code?

Cheers,
 
Back
Top