X-Git-Url: https://us-delaporte.pagekite.me/gitweb/dotfiles.git/blobdiff_plain/efae2fef386d0ef034983eecfdcdae31c5404d48..7b7663b9c3de414e6c01c96a5974b3d6b2ff9efe:/psmodules/file_management.psm1 diff --git a/psmodules/file_management.psm1 b/psmodules/file_management.psm1 index bbb6fa1..0db2101 100644 --- a/psmodules/file_management.psm1 +++ b/psmodules/file_management.psm1 @@ -6,9 +6,10 @@ Find 10 largest files on the C drive. #> function Show-LargeFiles() { param( - [int]$Max=10 + [int]$Max=10, + [string]$path="C:\Users" ) - Get-ChildItem c:\ -r| sort -descending -property length | select -first $Max name, Length, FullName + Get-ChildItem $path -r | sort -descending -property length | select -first $Max name, Length, FullName } <# @@ -45,7 +46,7 @@ Export-ModuleMember -Function Show-LargeFiles # Stay awake to allow large transfers to complete # without permanently giving up battery saving features -function Invoke-StayAwake() { +function Invoke-StayAwakeWindows() { param($minutes=90) $wsh = New-Object -ComObject WScript.Shell do{ @@ -58,4 +59,15 @@ function Invoke-StayAwake() { # Thank you to http://www.zhornsoftware.co.uk/caffeine/ } -Export-ModuleMember -Function Invoke-StayAwake \ No newline at end of file +Export-ModuleMember -Function Invoke-StayAwakeWindows + +function Invoke-StayAwake() { + param($minutes=90) + do{ + "Staying awake for $minutes minutes" + systemd-inhibit sleep 60 + $minutes-=1; + }until($minutes -lt 0) +} + +Export-ModuleMember -Function Invoke-StayAwake