Files : Files : MS JScript JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » MS JScript » Files »

 

Files









The Files object represents a collection of files in a folder.

Properties and Methods of the Files Object















Property/Method Description
Count Returns the number of items in a collection
Item Sets or returns an item based on a specific key















<html>
    <body>
    <script language="JScript">
    <!--
    function ShowList(foldername)
    {
      var myObject, f, MyFiles, names;
      myObject = new ActiveXObject("Scripting.FileSystemObject");
      f = myObject.GetFolder(foldername);
      myFiles = new Enumerator(f.files);
      names="";
      for (i=0; !myFiles.atEnd(); myFiles.moveNext()){
          names += myFiles.item();
          names += "<br>";
      }
      document.write(names);
    }
    -->
    </script>
    <form name="form1">
    Enter the name of an existing folder including the drive letter.
    <input type="text" size="35" name="file">
    <br><br>
    <input type="Button" value="Get File List" onClick='ShowList(document.form1.file.value)'>
    </form>
    </body>
    </html>







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo MS JScript
» Files