在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
/// <summary>
/// 创建文件路径
/// </summary>
/// <param name="filepath"></param>
/// <returns></returns>
private void CreatePath(string filepath)
{
if (!Directory.Exists(filepath))
{
var securityRules = new DirectorySecurity();
securityRules.AddAccessRule(new FileSystemAccessRule(System.Environment.UserName, FileSystemRights.FullControl, AccessControlType.Allow));
securityRules.AddAccessRule(new FileSystemAccessRule("Everyone", FileSystemRights.FullControl, AccessControlType.Allow));
securityRules.AddAccessRule(new FileSystemAccessRule("NETWORK SERVICE", FileSystemRights.FullControl, AccessControlType.Allow));
Directory.CreateDirectory(filepath, securityRules);
}
|
请发表评论