Skip to content

Instantly share code, notes, and snippets.

@nemo-kaz
Created November 16, 2013 07:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nemo-kaz/7497231 to your computer and use it in GitHub Desktop.
Save nemo-kaz/7497231 to your computer and use it in GitHub Desktop.
FREE command shows free space of each drive for Windows
//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