]> us-delaporte.pagekite.me Git - dotfiles.git/blobdiff - psmodules/drivespace.psm1
More tidying
[dotfiles.git] / psmodules / drivespace.psm1
index 47527c35ea911ff1e71e3a2784575dc444d09d15..b946f86d9f71531db914e71ae828d917e07aef4d 100644 (file)
@@ -5,7 +5,10 @@ Find 10 largest files on the C drive.
 
 #>
 function Show-LargeFiles() {
-        Get-ChildItem c:\ -r| sort -descending -property length | select -first 10 name, Length, FullName
+       param(
+               [int]$Max=10
+       )
+       Get-ChildItem c:\ -r| sort -descending -property length | select -first $Max name, Length, FullName
 }
 
 <#
@@ -21,5 +24,21 @@ function Show-Drivespace() {
        }
 }
 
-Export-ModuleMember -Function Show-Drivespace 
+function Show-DrivespacePretty() {
+       Start-Job -Name "FileCollection" -ScriptBlock { Show-Drivespace }
+While((Get-Job -Name "FileCollection").State -eq "Running") {
+            Write-Progress -Activity "Collecting Files..." -PercentComplete $x
+       If($x -eq 100){
+               $x = 1
+       }
+       Else{
+               $x += 1
+       }
+}
+Write-Progress -Activity "Collecting Files..." -Completed
+$Files = Get-Job -Name "FileCollection" | Receive-Job
+Get-Job -Name "FileCollection" | Remove-Job
+}
+
+Export-ModuleMember -Function Show-DriveSpace 
 Export-ModuleMember -Function Show-LargeFiles