<i>A tcl command to report free usable space of a partition of native file system</i>.
by
.
D 2025-11-21T13:39:55.867
J assignee nobody
J closer nobody
J cmimetype text/x-fossil-plain
J comment With\sa\stcl/tk\sapplication\susing\sseveral\sSQLite\sdatabases\swith\sSQLite\sTcl\sinterface,\swe\sneed\sto\scheck\savailable\sdisk\sspace\son\sthe\spartition\swhere\sthe\sdatabase\sfiles\sreside\sas\sthey\smay\sgrow\swihout\slimit.\r\n\r\nFor\sexample,\sthe\sVACCUM\sdb\soperation,\s(often\sused\son\sour\sside),\squoting\sSQLite\sdoc\sat\shttps://sqlite.org/lang_vacuum.html\s"works\sby\scopying\sthe\scontents\sof\sthe\sdatabase\sinto\sa\stemporary\sdatabase\sfile\sand\sthen\soverwriting\sthe\soriginal\swith\sthe\scontents\sof\sthe\stemporary\sfile....\sThis\smeans\sthat\swhen\sVACUUMing\sa\sdatabase,\sas\smuch\sas\stwice\sthe\ssize\sof\sthe\soriginal\sdatabase\sfile\sis\srequired\sin\sfree\sdisk\sspace"\r\n\r\nNot\ssure\sif\sthis\smeasure\sof\sfree\sspace\sneeds\sbyte\sprecision\r\n(on\sour\sside,\sthe\sinfo\sis\ssufficiant\sin\sMegabyte\sunit)\r\n\r\nFor\snow,\sas\sTcl\slacks\sthis\sfuctionality,\swe\sexecute\sfrom\sTcl\sthe\sfollowing\ssmall\sjava\sprogram\s:\r\n\r\nimport\sjava.io.File;\r\nimport\sjava.lang.Math;\r\n\r\npublic\sclass\sjava_HDfreespace\s{\r\n\s\s\s\s\r\n\s\s\s\spublic\sstatic\svoid\smain(String[]\sargs)\s{\r\n\s\s\s\s\s\s\s\s\r\n\s\s\s\s\s\s\s\s//\sEspace\sdisque\slibre\sutilisable\sen\soctet\r\n\s\s\s\s\s\s\s\s\s\s\s\s\r\n\s\s\s\s\s\s\s\s\s\s\s\slong\sfreeHDspace_o\s=\snew\sFile(args[0]).getUsableSpace();\s\s\s\s\s\s\s\s//\sgetUsableSpace()\sretourne\sun\sentier\slong\r\n\s\s\s\s\s\s\s\s\r\n\s\s\s\s\s\s\s\s//\sOn\sconvertit\sla\svaleur\sen\sMo\s->\sdivision\s1048576.0\s(=\s1024\s*\s1024)\r\n\s\s\s\s\s\s\s\s\s\s\s\s\r\n\s\s\s\s\s\s\s\s\s\s\s\sdouble\sfreeHDspace_mo\s=\sfreeHDspace_o\s/\s1048576.0;\r\n\s\s\s\s\s\s\s\s\r\n\s\s\s\s\s\s\s\s//\sRetour\sde\sla\svaleur\sarrondie\sà \s2\sdécimales\r\n\s\s\s\s\s\s\s\s\s\s\s\s\r\n\s\s\s\s\s\s\s\s\s\s\s\sSystem.out.println(Math.round(freeHDspace_mo\s*\s100.0)\s/\s100.0);\r\n\s\s\s\s\s\s\s\s\r\n\s\s\s\s\s\s\s\sSystem.exit(0);\r\n\s\s\s\s}\r\n}\r\n\r\n\r\nThank\syou\r\n\r\nJean-Marie
J is_private 0
J login anonymous
J priority 5\sMedium
J resolution None
J severity Minor
J status Open
J submitter anonymous
J subsystem -\sNew\sBuiltin\sCommands
J title A\stcl\scommand\sto\sreport\sfree\susable\sspace\sof\sa\spartition\sof\snative\sfile\ssystem
J type RFE
K 516d581c047786f7a51e1a574e43e8832447cc07
U anonymous
Z 080273e75e8d3fe07122c6feddcc1feb