Changing the ownership of files and folders
-
Hi, i can use this code to change the ownership of a directory ********************************************* DirectoryInfo dInfo = new DirectoryInfo(folderPath); DirectorySecurity oDirectorySecurity = new DirectorySecurity(); NTAccount owner = new NTAccount("Administrators"); oDirectorySecurity.SetOwner(owner); dInfo.SetAccessControl(oDirectorySecurity); ********************************************* but does anyone know how to make this recursive, so it changes the owner of all the sub files and folders? Many Thanks, Phil
-
Hi, i can use this code to change the ownership of a directory ********************************************* DirectoryInfo dInfo = new DirectoryInfo(folderPath); DirectorySecurity oDirectorySecurity = new DirectorySecurity(); NTAccount owner = new NTAccount("Administrators"); oDirectorySecurity.SetOwner(owner); dInfo.SetAccessControl(oDirectorySecurity); ********************************************* but does anyone know how to make this recursive, so it changes the owner of all the sub files and folders? Many Thanks, Phil
use Directory.GetDirectories and Directory.GetFiles instead and do it recursively hope it help
dhaim programming is a hobby that make some money as side effect :)
-
use Directory.GetDirectories and Directory.GetFiles instead and do it recursively hope it help
dhaim programming is a hobby that make some money as side effect :)