Загрузка...

Find Large Files, Empty Folders, Duplicate Files, Search By Text On Windows (No Download Required)

A video on how to find files by top 10 largest files, top 10 largest folders, find files by similar name, find files by text in the file, find all empty folders, find all duplicate files, on Windows with Command Prompt.

[top 10 largest files]
powershell -NoProfile -Command "$i=1; Get-ChildItem -Recurse -File | Sort-Object Length -Descending | Select-Object -First 10 | ForEach-Object { $size = if ($_.Length -ge 1TB) { '{0:N2} TB' -f ($_.Length / 1TB) } elseif ($_.Length -ge 1GB) { '{0:N2} GB' -f ($_.Length / 1GB) } elseif ($_.Length -ge 1MB) { '{0:N2} MB' -f ($_.Length / 1MB) } elseif ($_.Length -ge 1KB) { '{0:N2} KB' -f ($_.Length / 1KB) } else { '{0} B' -f $_.Length }; [PSCustomObject]@{No=$i;Path=$_.FullName;Size=$size}; $i++ } | Format-Table -AutoSize"

[top 10 largest folders]
powershell -NoProfile -Command "Get-ChildItem -Directory | ForEach-Object { $size = (Get-ChildItem $_.FullName -Recurse -File -ErrorAction SilentlyContinue | Measure-Object Length -Sum).Sum; [PSCustomObject]@{ Name = $_.Name; Size = if ($size -ge 1TB) { '{0:N2} TB' -f ($size / 1TB) } elseif ($size -ge 1GB) { '{0:N2} GB' -f ($size / 1GB) } elseif ($size -ge 1MB) { '{0:N2} MB' -f ($size / 1MB) } elseif ($size -ge 1KB) { '{0:N2} KB' -f ($size / 1KB) } else { '{0} B' -f $size }; Path = $_.FullName } } | Sort-Object {[decimal]($_.Size -replace '[^0-9.]','')} -Descending | Select-Object -First 10 | Format-Table -AutoSize"

[find files by similar name]
powershell -NoProfile -Command "$text = 'text here'; Get-ChildItem -Recurse -File | Where-Object { $_.BaseName -like \"*$text*\" } | Group-Object { $_.BaseName.ToLower() } | Sort-Object Count -Descending | Select-Object -First 10 | ForEach-Object { [PSCustomObject]@{ Name = $_.Name; Path = ($_.Group | Select-Object -First 1).FullName } } | Format-Table -AutoSize"

[find files by text in the file]
powershell -NoProfile -Command "Select-String -Path (Get-ChildItem -Recurse -File).FullName -Pattern 'your text here' -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Path -Unique | Format-Table -AutoSize"

[find all empty folders]
powershell -NoProfile -Command "Get-ChildItem -Recurse -Directory | Where-Object { @(Get-ChildItem $_.FullName -Force -Recurse -ErrorAction SilentlyContinue).Count -eq 0 } | Select-Object FullName | Format-Table -AutoSize"

[find all duplicate files]
powershell -NoProfile -Command "Get-ChildItem -Recurse -File | Group-Object { \"{0}_{1}\" -f $_.Name, $_.Length } | Where-Object { $_.Count -gt 1 } | ForEach-Object { $_.Group | Select-Object Name, Length, FullName } | Format-Table -AutoSize"

Видео Find Large Files, Empty Folders, Duplicate Files, Search By Text On Windows (No Download Required) канала TechXSoftware
Яндекс.Метрика
Все заметки Новая заметка Страницу в заметки
Страницу в закладки Мои закладки
На информационно-развлекательном портале SALDA.WS применяются cookie-файлы. Нажимая кнопку Принять, вы подтверждаете свое согласие на их использование.
О CookiesНапомнить позжеПринять