FileSystemObject.GetExtensionName() : FileSystemObject : MS JScript JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » MS JScript » FileSystemObject »

 

FileSystemObject.GetExtensionName()










Syntax








filesystemobject.GetExtensionName(path)



The GetExtensionName() method gets the file extension name for a specified file.

This method takes path as its only parameter.












<html>
    <body>
    <script language="JScript">
    <!--
    function getExt()
    {
        var myObject, ext;
        myObject = new ActiveXObject("Scripting.FileSystemObject");
        ext = myObject.GetExtensionName("c:\test.txt");
        alert("The extension for the testing file is: " + ext);
    }
    -->
    </script>
    Get the extension for the file "testing.txt".
    <form name="myForm">
    <input type="Button" value="Get Extension" onClick='getExt()'>
    </form>
    </body>
    </html>







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo MS JScript
» FileSystemObject