mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-04-21 17:38:19 +02:00
Added list-empty-files.ps1
This commit is contained in:
parent
cf7b28a93f
commit
61b0c3e65d
@ -30,6 +30,7 @@ list-current-timezone.ps1, lists the current time zone details
|
|||||||
list-clipboard.ps1, lists the contents of the clipboard
|
list-clipboard.ps1, lists the contents of the clipboard
|
||||||
list-environment-variables.ps1, lists all environment variables
|
list-environment-variables.ps1, lists all environment variables
|
||||||
list-empty-dirs.ps1, lists empty subfolders within the given directory tree
|
list-empty-dirs.ps1, lists empty subfolders within the given directory tree
|
||||||
|
list-empty-files.ps1, lists empty files within the given directory tree
|
||||||
list-files.ps1, lists all files in the given folder and also in every subfolder
|
list-files.ps1, lists all files in the given folder and also in every subfolder
|
||||||
list-formatted.ps1, lists the current working directory formatted in columns
|
list-formatted.ps1, lists the current working directory formatted in columns
|
||||||
list-fritzbox-calls.ps1, lists the FRITZ!Box calls
|
list-fritzbox-calls.ps1, lists the FRITZ!Box calls
|
||||||
|
|
@ -36,6 +36,7 @@ Table of Contents
|
|||||||
* [list-current-timezone.ps1](Scripts/list-current-timezone.ps1) - lists the current time zone details
|
* [list-current-timezone.ps1](Scripts/list-current-timezone.ps1) - lists the current time zone details
|
||||||
* [list-environment-variables.ps1](Scripts/list-environment-variables.ps1) - lists all environment variables
|
* [list-environment-variables.ps1](Scripts/list-environment-variables.ps1) - lists all environment variables
|
||||||
* [list-empty-dirs.ps1](Scripts/list-empty-dirs.ps1) - lists empty subfolders within the given directory tree
|
* [list-empty-dirs.ps1](Scripts/list-empty-dirs.ps1) - lists empty subfolders within the given directory tree
|
||||||
|
* [list-empty-files.ps1](Scripts/list-empty-files.ps1) - lists empty files within the given directory tree
|
||||||
* [list-installed-software.ps1](Scripts/list-installed-software.ps1) - lists the installed software
|
* [list-installed-software.ps1](Scripts/list-installed-software.ps1) - lists the installed software
|
||||||
* [list-files.ps1](Scripts/list-files.ps1) - lists all files in the given folder and also in every subfolder
|
* [list-files.ps1](Scripts/list-files.ps1) - lists all files in the given folder and also in every subfolder
|
||||||
* [list-formatted.ps1](Scripts/list-formatted.ps1) - lists the current working directory formatted in columns
|
* [list-formatted.ps1](Scripts/list-formatted.ps1) - lists the current working directory formatted in columns
|
||||||
|
@ -13,8 +13,9 @@ try {
|
|||||||
$DirTree = read-host "Enter the path to the directory tree"
|
$DirTree = read-host "Enter the path to the directory tree"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
write-progress "Checking symlinks in $DirTree..."
|
||||||
[int]$SymlinksTotal = [int]$SymlinksBroken = 0
|
[int]$SymlinksTotal = [int]$SymlinksBroken = 0
|
||||||
gci $DirTree -Recurse | Where { $_.Attributes -match "ReparsePoint" } | ForEach-Object {
|
Get-ChildItem $DirTree -recurse | Where { $_.Attributes -match "ReparsePoint" } | ForEach-Object {
|
||||||
$Symlink = $_.FullName
|
$Symlink = $_.FullName
|
||||||
$Target = ($_ | Select-Object -ExpandProperty Target -ErrorAction Ignore)
|
$Target = ($_ | Select-Object -ExpandProperty Target -ErrorAction Ignore)
|
||||||
if ($Target) {
|
if ($Target) {
|
||||||
|
22
Scripts/list-empty-files.ps1
Executable file
22
Scripts/list-empty-files.ps1
Executable file
@ -0,0 +1,22 @@
|
|||||||
|
#!/bin/powershell
|
||||||
|
<#
|
||||||
|
.SYNTAX ./list-empty-files.ps1 [<dir-tree>]
|
||||||
|
.DESCRIPTION lists empty files within the given directory tree
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
param($DirTree = "")
|
||||||
|
|
||||||
|
try {
|
||||||
|
if ($DirTree -eq "" ) {
|
||||||
|
$DirTree = read-host "Enter the path to the directory tree"
|
||||||
|
}
|
||||||
|
write-progress "Listing empty files in $DirTree ..."
|
||||||
|
Get-ChildItem $DirTree -recurse | Where {$_.PSIsContainer -eq $false} | Where {$_.Length -eq 0} | select FullName
|
||||||
|
echo "Done."
|
||||||
|
exit 0
|
||||||
|
} catch {
|
||||||
|
write-error "ERROR in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
exit 1
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user