Move directory and inherit permissions from target folder (as Copy would do)

386 Views Asked by At

That's what I want to achieve for my VCL application:

I extract a ZIP file to a directory in %TEMP%. If everything was okay, I move the directory to the target dir.

For the move operation I use JclFileUtils.FileMove (from JCL which resolves to MoveFileEx), because I need a real move operation and I want to overwrite files in the target dir.

This works so far, but the moved files have a per user file permission (inherited from Temp). I want the moved files to inherit permissions from the target folder.

Remarks:

  • Copy and delete is a workaround, I am aware of. But I want to avoid this (because of file size).
  • System.IOUtils.TFile.Move does not work for me, because it is implemented by copy and delete (in XE4).
  • Here a similar problem is described for .NET, but I do not know if an equivalent to GetAccessControl/SetAccessControl exists in Delphi.
0

There are 0 best solutions below