spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / experts / javascript / column71


Scripting the File System, Part I

Developer News
Jim Zemlin: The New Center of Linux Gravity
Microsoft's Novell Investment Tops $340M
Fedora 10 Takes Shape

The file Object

GetFile(pathName)Object

This method returns the file object of the given file name. The following script should create a file object for f:\yehuda\js\tips\myapps.txt:

<SCRIPT LANGUAGE="JavaScript">
<!--
var fso = new ActiveXObject("Scripting.FileSystemObject");
fileObj = fso.GetFile("f:\\yehuda\\js\\tips\\myapp.txt");
-->
</SCRIPT>

Here are the file object's properties:

PropertyDescription
AttributesRefers to the file attributes
DateCreatedReturns the file's creation date
DateLastAccessedReturns the file's last-accessed date
DateLastModifiedReturns the file's last-modified date
DriveReturns the file's letter drive
NameReturns the file name
ParentFolderReturns the file's parent folder name
PathReturns the file's long path
ShortPathReturns the file's short path
SizeReturns the file size
TypeReturns the file type

Here are the file object's methods:

MethodDescription
Copy()Copies the file from one folder to another
Delete()Removes the file
Move()Moves the file from one folder to another
OpenAsTextStream()Opens the file as a text stream

Next: How to use GetFolder()

http://www.internet.com



JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

webref The latest from WebReference.com Browse >
Simple Comments Meets OpenID · Primitive Data Types, Arrays, Loops, and Conditions: Part 3 · How to Create an Ajax Autocomplete Text Field: Part 11
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
eBay Finagles Fixed-Price and Final Value Fees, Cuts Paper Payments · SqlCredit, Part 18: Exploring the Performance of SQL 2005’s OUTPUT Clause · Epson Rolls Out Printers for the Smallest SMBs


Produced by Yehuda Shiran and Tomer Shiran
All Rights Reserved. Legal Notices.
Created: November 20, 2000
Revised: November 20, 2000

URL: http://www.webreference.com/js/column71/8.html