mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-04-12 12:07:05 +00:00
feat: Adding shim for setting file attributes recursively
This commit is contained in:
parent
ffb00f960d
commit
456a8f74f9
1 changed files with 13 additions and 0 deletions
|
|
@ -120,5 +120,18 @@ namespace ICD.Common.Utils.IO
|
||||||
{
|
{
|
||||||
File.Move(sourceFileName, destFileName);
|
File.Move(sourceFileName, destFileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if STANDARD
|
||||||
|
public static void SetAttributes(string path, FileAttributes attributes, bool recursive)
|
||||||
|
{
|
||||||
|
File.SetAttributes(path, attributes);
|
||||||
|
|
||||||
|
if (!recursive || !Directory.Exists(path))
|
||||||
|
return;
|
||||||
|
|
||||||
|
foreach (string innerPath in Directory.GetFileSystemEntries(path))
|
||||||
|
SetAttributes(innerPath, attributes, true);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue