Created
November 16, 2013 07:47
-
-
Save nemo-kaz/7497231 to your computer and use it in GitHub Desktop.
FREE command shows free space of each drive for Windows
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
//println "drv [ free ]G [ total ]G [free]%" | |
println "drv [ 空き ]G [ 計 ]G [Free]%" | |
allFree=0 | |
allTotal=0 | |
for (drive in "B".."Z") { | |
file = new File("${drive}:/") | |
BigDecimal free = file.getFreeSpace()/1000000000 | |
allFree=allFree+free | |
BigDecimal total= file.getTotalSpace()/1000000000 | |
allTotal=allTotal+total | |
if (total >0) { | |
print file | |
BigDecimal vaca = free/total*100 | |
printf (" [%7.1f]G [%7.1f]G [%2.1f]",free,total,vaca) | |
println "%" | |
} | |
} | |
printf ("総計[%7.1f]G [%7.1f]G ",allFree,allTotal) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment