Atomic FileSystem operations

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.
 
J

Joerg Jooss

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,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top