Location: PHPKode > scripts > getdisk > getdisk.php
#!/usr/bin/php
<?php
	error_reporting(0);
	function TOTAL_MEMORY($io) {
		$totalKB = number_format((disk_total_space($io) / 1024 * 100000) / 100000);
		$totalMB = number_format((disk_total_space($io) / 1048576 * 100000) / 100000);
		$totalGB = number_format((disk_total_space($io) / 1073741824 * 100000) / 100000);
		$totalTB = number_format((disk_total_space($io) * 100000 / 1099511627776) / 100000);
		return($totalGB . " Gb");
	}
	function FREE_MEMORY($io) {
		$freeKB = number_format((disk_free_space($io) / 1024 * 100000) / 100000);
		$freeMB = number_format((disk_free_space($io) / 1048576 * 100000) / 100000);
		$freeGB = number_format((disk_free_space($io) / 1073741824 * 100000) / 100000);
		$freeTB = number_format((disk_free_space($io) * 100000 / 1099511627776) / 100000);
		return($freeGB . " Gb");
	}
	function USED_MEMORY($io) {
		$usedKB = number_format((disk_total_space($io)-disk_free_space($io)) / 1024 * 100000 / 100000);
		$usedMB = number_format((disk_total_space($io)-disk_free_space($io)) / 1048576 * 100000 / 100000);
		$usedGB = number_format((disk_total_space($io)-disk_free_space($io)) / 1073741824 * 100000 / 100000);
		$usedTB = number_format((disk_total_space($io)-disk_free_space($io)) * 100000 / 1099511627776 / 100000);
		return($usedGB . " Gb");
	}

	if($_SERVER['argc'] != 2) {
		print("# Filename: getdisk.php");
		print("\n");
		print("# File Format: text/php");
		print("\n");
		print("# Date Created: Tuesday, October 19, 2010 7:00 AM EST America/New_York");
		print("\n");
		print("# Program Author: Sconexx - hide@address.com -  (347) 620-4225");
		print("\n");
		print("# Description: This PHP Application Will Get The Curent Disk Size,Used,Free Space.");
		print("\n");
		print("#");
		print("\n");
		print("# Usage: $ php disk [drive] <= Linux With PHP Installed");
		print("\n");
		print("# 	Example #1: php disk.php /");
		print("\n");
		print("#");
		print("\n");
		print("# Usage: C:\> php disk [drive] <= Windows With PHP Installed");
		print("\n");
		print("# 	Example #1: C:\> php disk.php C:");
		print("\n");
		print("#");
		print("\n");
		print("# For More Information Please Contact Me @ The Contact Info Above This From \"Program Author:\"");
		print("\n");
		print("# Copyright (c) 2010 - Powered By Kryptonites - Created By Sconexx - All Rights Reserved");
		print("\n");
		die("");
	}

	print("\n");
	print("Total Memory...: " . TOTAL_MEMORY($_SERVER['argv'][1]));
	print("\n");
	print("Used Memory....: " . USED_MEMORY($_SERVER['argv'][1]));
	print("\n");
	print("Free Memory....: " . FREE_MEMORY($_SERVER['argv'][1]));
	print("\n");
?>
Return current item: getdisk