Updated the manuals

This commit is contained in:
Markus Fleschutz
2025-05-12 22:04:02 +02:00
parent b3cdf19f4a
commit 09eb3d1808
651 changed files with 8362 additions and 1405 deletions

View File

@ -15,6 +15,7 @@ Parameters
Position? 1
Default value
Accept pipeline input? false
Aliases
Accept wildcard characters? false
-numDays <Int32>
@ -24,6 +25,7 @@ Parameters
Position? 2
Default value 1000
Accept pipeline input? false
Aliases
Accept wildcard characters? false
[<CommonParameters>]
@ -35,7 +37,9 @@ Example
-------
```powershell
PS> ./remove-old-dirs.ps1 C:\Temp 365
Removed 0 subfolders in 1s (67 skipped).
Scanning C:\Temp for subfolders older than 365 days...
Removing old 'TestFolder'...
Removed 1 of 49 subfolders in 1s.
```
@ -61,7 +65,9 @@ Script Content
Specifies the number of days (1000 by default)
.EXAMPLE
PS> ./remove-old-dirs.ps1 C:\Temp 365
✅ Removed 0 subfolders in 1s (67 skipped).
⏳ Scanning C:\Temp for subfolders older than 365 days...
⏳ Removing old 'TestFolder'...
✅ Removed 1 of 49 subfolders in 1s.
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -76,21 +82,19 @@ try {
if (!(Test-Path -Path "$path" -PathType container)) { throw "Given path doesn't exist - enter a valid path, please" }
Write-Host "⏳ Searching in '$path' for subfolders older than $numDays days..."
$numRemoved = $numSkipped = 0
$numRemoved = 0
$folders = Get-ChildItem -path "$path" -directory
foreach ($folder in $folders) {
[datetime]$folderDate = ($folder | Get-ItemProperty -Name LastWriteTime).LastWriteTime
if ($folderDate -lt (Get-Date).AddDays(-$numDays)) {
Write-Host "Removing old '$folder'..."
Write-Host "Removing old '$folder'..."
$fullPath = $folder | Select-Object -ExpandProperty FullName
Remove-Item -path "$fullPath" -force -recurse
$numRemoved++
} else {
$numSkipped++
}
}
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
"✅ Removed $numRemoved subfolders in $($elapsed)s ($numSkipped skipped)."
"✅ Removed $numRemoved of $($folders.Count) subfolders in $($elapsed)s."
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
@ -98,4 +102,4 @@ try {
}
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:24)*
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:58)*