ColdFusion and how to get the information about your HardDrive aka getFreeSpace()

I saw a tweet this morning about ColdFusion and getFreeSpace() and what surprised me was the responses from people about this tweet, I am of the believer that one doesn't need to keep introducing features into ColdFusion when it is not needed.

And from what I can tell this is something that people are seeming like wanting, and I don't know why.

As it is now it is very easy to get the information that one requires plus more.

<cfscript>
   objFile = createObject("java","java.io.File").init(JavaCast("string", "C:\"));
   totalSpace = objFile.getTotalSpace(); //total disk space in bytes.
   usableSpace = objFile.getUsableSpace(); ///unallocated / free disk space in bytes.
   freeSpace = objFile.getFreeSpace(); //unallocated / free disk space in bytes.
</cfscript>
<cfoutput>
   === Partition Detail ===<br /><br />
   === bytes ===<br />
   Total size : #totalSpace# bytes<br />
   Space free : #usableSpace# bytes<br />
   Space free : #freeSpace# bytes<br /><br />
   === mega bytes ===<br />
    Total size : #totalSpace/1024/1024# mb<br />
    Space free : #usableSpace/1024/1024# mb<br />
    Space free : #freeSpace/1024/1024# mb<br />
</cfoutput>

Now what would be totally cool is for people to think outside of the box some more, and push Adobe to do the same, because it would be way cooler if ColdFusion was to adobe a better approach to the language and also leverage of its underlying technology as well.

I have blogged about this in the past, and it is still relevant that Adobe should be heading down this path today.

So what would actually have been cooler is to type this in the code instead.

import java.io.File;
file = new File("c:");
writeDump(file);

Not only is it neater and cooler to do, but we as developers are now harnessing the power of what we are built on top off. It also means that we are to have a far better library of code to leverage from, as well as we are not adding more features to the language that are not needed. Or have been given total over kill, as an example to that would be the ColdFusion FileOpen, FileRead, FileMove etc.

But the number one thing is that ColdFusion starts to move into an Object Orientated Programming style, and begin to be seen as a more serious language.


@adrocknaphobia getFreeDiskSpace() in ColdFusion http://bit.ly/bBDKGg Oct 27, 2010
ColdFusion and how to get the information about your HardDrive aka getFreeSpace() - http://cfbloggers.org/?c=45404 Oct 27, 2010