0

I'm using transactional NTFS wrapper that is available on msdn here to support atomic transactions of file system operations, the available example only shows how to work with transactedFiles but I need also to create, move and copy transacted Directories, I don't know how to use TransactedDirectory Class, can you please help? I tried this code but it doesn't seem to be correct:

   if (Transaction.Current == null)
        {
            throw new Exception("Must be within a transaction scope");
        }
        using (TransactionScope folderTransaction = new TransactionScope(Transaction.Current))
        {
            TransactedDirectory.StartTxFResource("D:\\New");

           folderTransaction.Complete();
           TransactedDirectory.StopTxFResource("D:\\New");

        }

it gives an error "access denied, the folder is being used by another process".

Lisa
  • 3,121
  • 15
  • 53
  • 85

1 Answers1

0

Under which User Account is your process running? Check if it has access to the D:\New folder.

For a quick check, run the process as Administrator (Right click myprocess.exe > Run As Administrator), and if it works then, you should either set the correct permissions, or setup your code to require admin level access.

RoelF
  • 7,483
  • 5
  • 44
  • 67