Created
August 12, 2022 10:14
-
-
Save jamiechalmerzlp/c61095df96d63793f982432d0eb4d6bb to your computer and use it in GitHub Desktop.
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
$Files = Get-ChildItem -Path "your\directory\here" -File -Recurse -Name -Force -ErrorAction SilentlyContinue | Measure-Object | Select-Object @{Name='File(s) Count';Expression={$_.count}} | |
$Folders = Get-ChildItem -Path "your\directory\here" -Directory -Recurse -Name -Force -ErrorAction SilentlyContinue | Measure-Object | Select-Object @{Name='Folder Count';Expression={$_.count}} | |
write-host "Files: $Files" | |
write-host "Folders: $Folders" |
Check this related one for reporting on the age of files in these directories - helps in sifting through and moving old data out - https://gist.github.com/pstakuu/e25fa725172342a5402a03de6633688f
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I know this one leaves the @{} in the lines for output, and to be honest, I can't be bothered to clear it up... you are only using this as reference to count files and folders for verification purposes or something any way.