Last active
September 17, 2024 08:47
-
-
Save danielniccoli/f221abdd7567b7cc01cc91e9ff926270 to your computer and use it in GitHub Desktop.
Remove File Attributes that are not supported in PowerShell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Removes all OneDrive attributes from files | |
Get-ChildItem * -Recurse -Depth 999 | % { | |
$flagsToRemove = 0x00040000 -bor 0x00080000 -bor 0x00100000 -bor 0x00040000 -bor 0x00400000 | |
$flags = [System.IO.File]::GetAttributes($_.FullName) | |
$fixedFlags = $flags -band (-bnot $flagsToRemove) | |
[System.IO.File]::SetAttributes($_.FullName, $fixedFlags) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment