pricejt
New member
- Joined
- May 8, 2007
- Messages
- 3
- Programming Experience
- 3-5
I am trying to move files into a folder and I want to grab the permissions of the parent directory that I am moving the files into and set those as the permissions for my files.
Here is my code. I get no errors but it doesn't seem to be getting the permissions. If any one has any ideas i would really appreciate it.
FileA is the current file that I am moving into MoveFile
Here is my code. I get no errors but it doesn't seem to be getting the permissions. If any one has any ideas i would really appreciate it.
FileA is the current file that I am moving into MoveFile
VB.NET:
My.Computer.FileSystem.MoveFile(FileA, MoveFile)
Dim fs As FileSecurity = File.GetAccessControl(MoveFile)
Dim ds As DirectorySecurity = Directory.GetAccessControl(FolderB)
Dim rules = ds.GetAccessRules(True, True, GetType(SecurityIdentifier))
For Each Rule As FileSystemAccessRule In rules
'Dim modifiedRule As FileSystemAccessRule = New FileSystemAccessRule(Rule.IdentityReference, FileSystemRights.Write Or FileSystemRights.DeleteSubdirectoriesAndFiles, InheritanceFlags.None, Rule.PropagationFlags, Rule.AccessControlType)
Dim modifiedRule As FileSystemAccessRule = New FileSystemAccessRule(Rule.IdentityReference, FileSystemRights.FullControl, InheritanceFlags.None, Rule.PropagationFlags, Rule.AccessControlType)
fs.AddAccessRule(modifiedRule)
Next