PoshCode Archive  Artifact Content

Artifact c6f55841087d86165985c55c0758a08c105d939e532c466f852faabc336382e7:

  • File df.ps1 — part of check-in [c284a845fe] at 2018-06-10 13:38:55 on branch trunk — A simple df (disk free) function for PowerShell (user: unknown size: 532)

# encoding: ascii
# api: powershell
# title: df
# description: A simple df (disk free) function for PowerShell
# version: 0.1
# type: function
# license: CC0
# x-poshcode-id: 428
# x-archived: 2010-12-15T11:53:25
#
#
function df ( $Path ) {
	if ( !$Path ) { $Path = (Get-Location -PSProvider FileSystem).ProviderPath }
	$Drive = (Get-Item $Path).Root -replace "\\"
	$Output = Get-WmiObject -Query "select freespace from win32_logicaldisk where deviceid = `'$drive`'"
	Write-Output "$($Output.FreeSpace / 1mb) MB"
}