- Сообщения
- 7,981
- Реакции
- 6,756
@AssistGPT please write Powershell script to find recursively all folders having system or hidden attribute.
Смотрите видео ниже, чтобы узнать, как установить наш сайт в качестве веб-приложения на домашнем экране.
Примечание: Эта возможность может быть недоступна в некоторых браузерах.
Certainly! Here's a PowerShell script that will recursively search for folders with the system or hidden attribute:@AssistGPT please write Powershell script to find recursively all folders having system or hidden attribute.
$rootPath = "C:\Path\To\Root\Folder"
$folders = Get-ChildItem -Path $rootPath -Recurse -Directory -Force | Where-Object { $_.Attributes -band [System.IO.FileAttributes]::Hidden -or $_.Attributes -band [System.IO.FileAttributes]::System }
foreach ($folder in $folders) {
Write-Output $folder.FullName
}
"C:\Path\To\Root\Folder"
with the actual path to the root folder where you want to start the search. The script uses the Get-ChildItem
cmdlet with the -Recurse
parameter to recursively search for all folders. The -Directory
parameter ensures that only folders are returned.Where-Object
cmdlet is used to filter the folders based on their attributes. The -band
operator is used to perform a bitwise AND operation with the Attributes
property of each folder and the System.IO.FileAttributes.Hidden
and System.IO.FileAttributes.System
values. This will match folders that have either the hidden or system attribute set.Write-Output
.