November 02, 2000 - Finding a File's Parent Folder | WebReference

November 02, 2000 - Finding a File's Parent Folder

Yehuda Shiran November 02, 2000
Finding a File's Parent Folder
Tips: November 2000

Yehuda Shiran, Ph.D.
Doc JavaScript

To find a file's folder, use the ParentFolder() method of the File object. Here is a piece of script that will print a file's folder:

<SCRIPT LANGUAGE="JavaScript">
<!--
  myActiveXObject = new ActiveXObject("Scripting.FileSystemObject");
  file = myActiveXObject.GetFile("f:\\yehuda\test.txt");
  alert(file.ParentFolder());
// -->
</SCRIPT>

Here is the popout window that you'll get: