CS3 JS: Folder

CS3 JavaScript

Folder

 Represents a file-system folder or directory in a platform-independent manner.

QuickLinks

Folder, changePath, create, decode, encode, execute, getFiles, getRelativeURI, isEncodingAvailable, remove, rename, resolve, selectDialog, selectDlg, toSource, toString

Properties

PropertyTypeAccessDescription
absoluteURIstringreadonlyThe full path name for the referenced folder in URI notation.
aliasboolreadonlyWhen true, the object refers to a file system alias or shortcut.
appDataFolderreadonly

The folder containing the application data for all users.

In Windows, the value of %APPDATA% (by default, C:\\Documents and Settings\\All Users\\Application Data) In Mac OS, /Library/Application Support

appPackageFolderreadonlyIn Mac OS, a Folder object for the folder containing the bundle of the running application.
commonFilesFolderreadonly

A Folder object for the folder containing common files for all programs installed by the user.

In Windows, the value of %CommonProgramFiles% (by default, C:\\Program Files\\Common Files) In Mac OS, /Library/Application Support

createdDatereadonlyThe creation date of the referenced folder, or null if the object does not refer to a folder on disk.
currentFolderr/w

A Folder object for the current folder.

Assign a Folder object or a string containing the new path name to set the current folder. This is a class property accessed through the Folder constructor.

desktopFolderreadonly

A Folder object for the folder that contains the user’s desktop.

In Windows, C:\\Documents and Settings\\username\\Desktop In Mac OS, ~/Desktop

displayNamestringreadonlyThe localized name portion of the absolute URI for the referenced folder, without the path specification.
errorstringr/w

A message describing the most recent file system error.

Typically set by the file system, but a script can set it. Setting this value clears any error message and resets the error bit for opened files. Contains the empty string if there is no error.

existsboolreadonlyWhen true, this object refers to a folder that currently exists in the file system.
fsstringreadonly

The name of the current file system.

One of "Windows", "Macintosh", or "Unix".

fsNamestringreadonlyThe platform-specific name of the referenced folder as a full path name.
fullNamestringreadonlyThe full path name for the referenced folder in URI notation. .
modifiedDatereadonlyThe date of the referenced folder's last modification, or null if the object does not refer to a folder on disk.
myDocumentsFolderreadonly

A folder pointing to the user's My Documents folder.

In Windows, C:\\Documents and Settings\\username\\My Documents In Mac OS, ~/Documents

namestringreadonlyThe folder name portion of the absolute URI for the referenced file, without the path specification.
parentFolderreadonlyTThe Folder object for the folder that contains this folder, or null if this object refers to the root folder of a volume.
pathstringreadonlyThe path portion of the object absolute URI for the referenced file, without the folder name.
relativeURIstringreadonlyThe path name for the referenced folder in URI notation, relative to the current folder.
startupFolderreadonlyA Folder object for the folder containing the executable image of the running application.
systemFolderreadonly

A Folder object for the folder containing the operating system files.

In Windows, the value of %windir% (by default, C:\\Windows) In Mac OS, /System

tempFolderreadonlyA Folder object for the default folder for temporary files.
trashFolderreadonlyA Folder object for the folder containing deleted items.
userDataFolderreadonly

A Folder object for the folder containing the user's application data.

In Windows, the value of %USERDATA% (by default, C:\\Documents and Settings\\username\\Application Data) In Mac OS, ~/Library/Application Support.

Methods

Folder Folder (path:string)
Creates and returns a new Folder object referring to a given file-system location.

ParameterTypeDescription
pathstringThe absolute or relative path to the folder associated with this object, specified in URI format.

bool changePath (path:string)
Changes the path specification of the referenced folder.

ParameterTypeDescription
pathstringA string containing the new path, absolute or relative to the current folder.

bool create ()
Creates a folder at the location given by this object's path property.

string decode (uri:string)
Decodes a UTF-8 encoded string as required by RFC 2396, and returns the decoded string.

ParameterTypeDescription
uristringThe UTF-8 string to decode.

string encode (name:string)
Encodes a string as required by RFC 2396, and returns the encoded string.

ParameterTypeDescription
namestringThe string to encode.

bool execute ()
Opens this folder in the platform-specific file browser (as if it had been double-clicked in the file browser).

Array getFiles (mask:any)
Retrieves the contents of this folder, filtered by the supplied mask.

ParameterTypeDescription
mask any A search mask for file names, specified as a string or a function.

string getRelativeURI ( [basePath:string=.])
Retrieves and returns the path for this file, relative to the specified base path, in URI notation.

ParameterTypeDescription
basePathstringA base path in URI notation. (default: .)

bool isEncodingAvailable (name:string)
Reports whether a given encoding is available.

ParameterTypeDescription
namestringThe encoding name.

bool remove ()
Deletes the folder associated with this object from disk immediately, without moving it to the system trash.

bool rename (newName:string)
Renames the associated folder.

ParameterTypeDescription
newNamestringThe new folder name, with no path information.

Folder resolve ()
Attempts to resolve the file-system alias or shortcut that this object refers to.

Folder selectDialog (prompt:string)
Opens the built-in platform-specific file-browsing dialog, and creates a new File or Folder object for the selected file or folder.

ParameterTypeDescription
promptstringThe prompt text, if the dialog allows a prompt.

Folder selectDlg (prompt:string)
Opens the built-in platform-specific file-browsing dialog, and creates a new File or Folder object for the selected file or folder.

ParameterTypeDescription
promptstringThe prompt text, if the dialog allows a prompt.

string toSource ()
Creates and returns a serialized string representation of this object.

string toString ()
Converts this object to a string.

Element of

File.parent

Folder.appData

Folder.appPackage

Folder.commonFiles

Folder.current

Folder.desktop

Folder.myDocuments

Folder.parent

Folder.startup

Folder.system

Folder.temp

Folder.trash

Folder.userData

Return

Folder Folder.Folder (path:string)

Folder Folder.resolve ()

Folder Folder.selectDialog (prompt:string)

Folder Folder.selectDlg (prompt:string)

Contents :: Index