Packageshell
Classpublic class FileSystem
InheritanceFileSystem Inheritance Object

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

The FileSystem class Provides methods to access and manipulate computer files, directories, paths and data.

A filename uniquely identify a file or directory stored on the file system.

A filepath identify a path to a directory stored on the file system.

A component is a name of a part composing a filename exluding the separators.



Public Properties
 PropertyDefined By
  AVM-only drives : Array
[static] [read-only] The list of drives.
FileSystem
  AVM-only homeDirectory : String
[static] [read-only] The user home directory.
FileSystem
  AVM-only lineEnding : String
[static] [read-only] The line-ending character sequence used by the host operating system.
FileSystem
  AVM-only pathSeparator : String
[static] [read-only] The path separator used by the operating system.
FileSystem
  AVM-only rootDirectory : String
[static] [read-only] The system root directory.
FileSystem
  AVM-only separators : Array
[static] [read-only] The character separators used by the operating system.
FileSystem
Public Methods
 MethodDefined By
 Inherited
_init():*
[static]
_init
  
[static] Returns the absolute path of filename.
FileSystem
  
AVM-only bufferedCopyFile(origin:String, destination:String, buffer:int = 0, overwrite:Boolean = false, copyMode:Boolean = false):Boolean
[static] Copy by chunk of buffer an origin file to a destination file and returns true on success.
FileSystem
  
AVM-only bufferedFastCopyFile(origin:String, destination:String, buffer:int = 0, overwrite:Boolean = false, copyMode:Boolean = false):Boolean
[static] Copy by chunk of buffer an origin file to a destination file and returns true on success.
FileSystem
  
AVM-only bufferedReadByteArray(filename:String, buffer:int = 0):ByteArray
[static] Reads by chunk of buffer the binary file filename into memory and returns it as a ByteArray.
FileSystem
  
AVM-only bufferedWriteByteArray(filename:String, bytes:ByteArray, buffer:int = 0):Boolean
[static] Writes by chunk of buffer the binary bytes to the file filename and returns true on success.
FileSystem
  
[static] Verify if we can access the filename.
FileSystem
  
AVM-only canRead(filename:String):Boolean
[static] Verify if we can read the filename.
FileSystem
  
AVM-only canWrite(filename:String):Boolean
[static] Verify if we can write to the filename.
FileSystem
  
[static] Tests if a parent filename contains a child filename.
FileSystem
  
AVM-only copyDirectory(origin:String, destination:String, overwrite:Boolean = false, noHidden:Boolean = true, copyMode:Boolean = false):Boolean
[static] Recursively copy the content of an origin directory to a destination directory and returns true on success.
FileSystem
  
AVM-only copyFile(origin:String, destination:String, overwrite:Boolean = false, copyMode:Boolean = false):Boolean
[static] Copy an origin file to a destination file and returns true on success.
FileSystem
  
AVM-only copyFiles(origin:String, destination:String, filter:RegExp = null, overwrite:Boolean = false, noHidden:Boolean = true, copyMode:Boolean = false):Boolean
[static] Copy all files matching the filter from directory origin to destination directory and returns true on success.
FileSystem
  
AVM-only create(filename:String, useBOM:Boolean = false):void
[static] Creates a text file filename.
FileSystem
  
[static] Creates a binary file filename and returns true on success.
FileSystem
  
[static] Creates a directory path from filename, iterates trough the path components and create the missing directories if needed.
FileSystem
  
[static] Tests if filename ends with a separator.
FileSystem
  
[static] Returns filename ending with a separator.
FileSystem
  
AVM-only exists(filename:String):Boolean
[static] Tests whether a filename exists.
FileSystem
  
[static] Returns a filepath corresponding to the last path component of this filename, either a file or a directory.
FileSystem
  
[static] Returns the components of a filename.
FileSystem
  
[static] Returns the directory component of a filename without the trailing path separator, or an empty string on error.
FileSystem
  
AVM-only getDirectorySize(filename:String, recursive:Boolean = true, includeHidden:Boolean = true):Number
[static] Returns the directory filename size in bytes (adding all its files size) and if recursive add the size of any child directory entries.
FileSystem
  
[static] Returns the filename last access time.
FileSystem
  
[static] Returns the filename last changed time.
FileSystem
  
AVM-only getFileMode(filename:String):int
[static] Returns the filename mode.
FileSystem
  
[static] Returns the filename last modified time.
FileSystem
  
[static] Returns the file filename size in bytes.
FileSystem
  
[static] Returns the available disk space in bytes on the volume containing filename, or -1 on failure.
FileSystem
  
AVM-only getSize(stream:FILE):Number
[static] Returns the FILE stream size in bytes.
FileSystem
  
[static] Returns the total disk space in bytes on the volume containing filename, or -1 on failure.
FileSystem
  
[static] Returns the used disk space in bytes on the volume containing filename, or -1 on failure.
FileSystem
  
[static] Tests if the filename contains a drive letter.
FileSystem
 Inherited
AS3
 Inherited
init():*
[static]
init
  
[static] Tests if the filename is a directory.
FileSystem
  
[static] Tests if the mode represents a directory.
FileSystem
  
[static] Tests if the entry is the current directory . or the parent directory ...
FileSystem
  
[static] Tests if the filename is an empty directory.
FileSystem
  
AVM-only isHidden(filename:String):Boolean
[static] Tests if the filename is considered hidden by the system.
FileSystem
 Inherited
AS3
  
[static] Test if the filename is a regular file.
FileSystem
  
[static] Test if the mode represents a regular file.
FileSystem
  
[static] Tests if the character c is a separator.
FileSystem
  
AVM-only isValid(filename:String):Boolean
[static] Tests if the filename is valid under the current system rules.
FileSystem
  
[static] Tests if the component is valid under the current system rules.
FileSystem
  
[static] Tests if the filename is valid under all file system rules.
FileSystem
  
[static] Tests if the component is valid under all file system rules.
FileSystem
  
[static] Tests if the component is valid under Linux file system rules.
FileSystem
  
[static] Tests if the component is valid under Macintosh file system rules.
FileSystem
  
[static] Tests if the component is valid under Windows file system rules.
FileSystem
  
AVM-only listByBreadth(filepath:String, includePath:Boolean = false, noHidden:Boolean = true, sorting:int = -1):Array
[static] Returns an array of files and directories sorted by breadth.
FileSystem
  
AVM-only listByDepth(filepath:String, includePath:Boolean = false, noHidden:Boolean = true, sorting:int = -1):Array
[static] Returns an array of files and directories sorted by depth.
FileSystem
  
AVM-only listDirectories(filepath:String, noDots:Boolean = true, noHidden:Boolean = true, sorting:int = -1):Array
[static] Returns an array of directories from filename.
FileSystem
  
AVM-only listDirectoriesWithFilter(filepath:String, filter:Function, noDots:Boolean = true, noHidden:Boolean = true, sorting:int = -1):Array
[static] Returns an array of directories from filename filtered by a function.
FileSystem
  
AVM-only listDirectoriesWithRegexp(filepath:String, filter:RegExp, noDots:Boolean = true, noHidden:Boolean = true, sorting:int = -1):Array
[static] Returns an array of directories from filename filtered by a regular expression.
FileSystem
  
AVM-only listFiles(filepath:String, noDots:Boolean = true, noHidden:Boolean = true, sorting:int = -1):Array
[static] Returns an array of files from filename.
FileSystem
  
AVM-only listFilesOrDirectories(filepath:String, noDots:Boolean = true, noHidden:Boolean = true, sorting:int = -1):Array
[static] Returns an array of files and directories from filename.
FileSystem
  
AVM-only listFilesOrDirectoriesWithFilter(filepath:String, filter:Function, noDots:Boolean = true, noHidden:Boolean = true, sorting:int = -1):Array
[static] Returns an array of files and directories from filename filtered by a function.
FileSystem
  
AVM-only listFilesOrDirectoriesWithRegexp(filepath:String, filter:RegExp, noDots:Boolean = true, noHidden:Boolean = true, sorting:int = -1):Array
[static] Returns an array of files and directories from filename filtered by a regular expression.
FileSystem
  
AVM-only listFilesWithFilter(filepath:String, filter:Function, noDots:Boolean = true, noHidden:Boolean = true, sorting:int = -1):Array
[static] Returns an array of files from filename filtered by a function.
FileSystem
  
AVM-only listFilesWithRegexp(filepath:String, filter:RegExp, noDots:Boolean = true, noHidden:Boolean = true, sorting:int = -1):Array
[static] Returns an array of files from filename filtered by a regular expression.
FileSystem
  
AVM-only move(origin:String, destination:String, overwrite:Boolean = false, force:Boolean = false):Boolean
[static] Moves an origin entry (file or directory) to a destination entry and returns true on success.
FileSystem
  
[static] Reads the file filename into memory and returns it as a String.
FileSystem
  
[static] Reads the binary file filename into memory and returns it as a ByteArray.
FileSystem
  
AVM-only nativeWrite(filename:String, data:String):void
[static] Writes the text data to the file filename.
FileSystem
  
[static] Writes the binary bytes to the file filename and returns true on success.
FileSystem
  
[static] Normalizes the separators of the filename.
FileSystem
 Inherited
AS3
  
AVM-only read(filename:String):String
[static] Reads the file filename into memory and returns it as a String.
FileSystem
  
[static] Reads the binary file filename into memory and returns it as a ByteArray.
FileSystem
  
AVM-only remove(filename:String, recursive:Boolean = false):void
[static] Removes an entry (file or directory) from the file system.
FileSystem
  
AVM-only removeDirectory(filename:String, recursive:Boolean = false):void
[static] Removes a directory entry from the file system, if recursive=true delete all child entries (files and directories) first.
FileSystem
  
AVM-only removeFile(filename:String):void
[static] Removes a file entry from the file system.
FileSystem
  
[static] Remove trailing separators from the filename.
FileSystem
  
AVM-only write(filename:String, data:String, useBOM:Boolean = false):void
[static] Writes the text data to the file filename.
FileSystem
  
[static] Writes the binary bytes to the file filename and returns true on success.
FileSystem
Protected Methods
 MethodDefined By
 Inherited
[static]
protected
 Inherited
_setPropertyIsEnumerable(o:*, V:String, enumerable:Boolean):void
[static]
protected
Public Constants
 ConstantDefined By
  AVM-only currentDirectory : String = "."
[static] A special path component meaning "this directory".
FileSystem
  AVM-only extensionSeparator : String = "."
[static] The character used to identify a file extension.
FileSystem
 Inheritedlength : int = 1
[static]
length
  AVM-only parentDirectory : String = ".."
[static] A special path component meaning "the parent directory".
FileSystem
Property Detail
AVM-only drivesproperty
drives:Array  [read-only]

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4, Windows only

The list of drives.

Always empty on Macintosh and Linux.


Implementation
    public static function get drives():Array
AVM-only homeDirectoryproperty 
homeDirectory:String  [read-only]

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

The user home directory.


Implementation
    public static function get homeDirectory():String
AVM-only lineEndingproperty 
lineEnding:String  [read-only]

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

The line-ending character sequence used by the host operating system.


Implementation
    public static function get lineEnding():String
AVM-only pathSeparatorproperty 
pathSeparator:String  [read-only]

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

The path separator used by the operating system.


Implementation
    public static function get pathSeparator():String
AVM-only rootDirectoryproperty 
rootDirectory:String  [read-only]

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

The system root directory.


Implementation
    public static function get rootDirectory():String
AVM-only separatorsproperty 
separators:Array  [read-only]

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

The character separators used by the operating system.


Implementation
    public static function get separators():Array
Method Detail
AVM-only absolutePath()method
public static function absolutePath(filename:String):String

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Returns the absolute path of filename.

Parameters

filename:String — The filename to transform.

Returns
String — the filename as an absolute path.
AVM-only bufferedCopyFile()method 
public static function bufferedCopyFile(origin:String, destination:String, buffer:int = 0, overwrite:Boolean = false, copyMode:Boolean = false):Boolean

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Copy by chunk of buffer an origin file to a destination file and returns true on success.

This method cannot handle files bigger than 2 GB, or 2147483647 bytes or MAX_INT or int.MAX_VALUE.

Parameters

origin:String — The origin filename to copy from.
 
destination:String — The destination filename to copy into.
 
buffer:int (default = 0) — The size of the buffer in bytes.
 
overwrite:Boolean (default = false) — if true overwrite an already existing destination.
 
copyMode:Boolean (default = false) — if true copy also the filename mode.

Returns
Booleantrue if the file copied successfully otherwise false.
AVM-only bufferedFastCopyFile()method 
public static function bufferedFastCopyFile(origin:String, destination:String, buffer:int = 0, overwrite:Boolean = false, copyMode:Boolean = false):Boolean

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Copy by chunk of buffer an origin file to a destination file and returns true on success.

this works like bufferedCopyFile() except here we don't check for files boundaries, technically any file size could be copied provided the system have the ressources and provided you are ready to wait long enough for the file to be copied.

Parameters

origin:String — The origin filename to copy from.
 
destination:String — The destination filename to copy into.
 
buffer:int (default = 0) — The size of the buffer in bytes.
 
overwrite:Boolean (default = false) — if true overwrite an already existing destination.
 
copyMode:Boolean (default = false) — if true copy also the filename mode.

Returns
Booleantrue if the file copied successfully otherwise false.
AVM-only bufferedReadByteArray()method 
public static function bufferedReadByteArray(filename:String, buffer:int = 0):ByteArray

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Reads by chunk of buffer the binary file filename into memory and returns it as a ByteArray.

A buffered read is bit slower but allow to progressively read a file and so can be usefull when reading big files.

This method cannot handle files bigger than 2 GB, or 2147483647 bytes or MAX_INT or int.MAX_VALUE.

The default buffer value is 0, in this situation the method will automically assign a buffer.

Internally ByteArray use a threshold of 24 MB to switch to large-size handling, so when the buffer is 0 the automatically assigned buffer is 512 KB for files smaller than 24 MB, and for bigger files the buffer is 24 MB.

Parameters

filename:String — The filename to read.
 
buffer:int (default = 0) — The size of the buffer in bytes.

Returns
ByteArray — the ByteArray data contained in the filename.
AVM-only bufferedWriteByteArray()method 
public static function bufferedWriteByteArray(filename:String, bytes:ByteArray, buffer:int = 0):Boolean

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Writes by chunk of buffer the binary bytes to the file filename and returns true on success.

Parameters

filename:String — The filename to write.
 
bytes:ByteArray — the binary data to write into the file.
 
buffer:int (default = 0) — The size of the buffer in bytes.

Returns
Booleantrue if written successfully, otherwise false.
AVM-only canAccess()method 
public static function canAccess(filename:String):Boolean

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Verify if we can access the filename.

Parameters

filename:String — The filename to test.

Returns
Booleantrue if filename can be accessed, otherwise false.
AVM-only canRead()method 
public static function canRead(filename:String):Boolean

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Verify if we can read the filename.

Parameters

filename:String — The filename to test.

Returns
Booleantrue if filename can be read, otherwise false.
AVM-only canWrite()method 
public static function canWrite(filename:String):Boolean

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Verify if we can write to the filename.

Parameters

filename:String — The filename to test.

Returns
Booleantrue if can write to the filename, otherwise false.
AVM-only containsPath()method 
public static function containsPath(parent:String, child:String):Boolean

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Tests if a parent filename contains a child filename.

Both paths are converted to absolute paths before doing the comparison.

Parameters

parent:String — The filename considered as the parent or container.
 
child:String — The filename considered as the child or containee.

Returns
Booleantrue if parent contains child, otherwise false.
AVM-only copyDirectory()method 
public static function copyDirectory(origin:String, destination:String, overwrite:Boolean = false, noHidden:Boolean = true, copyMode:Boolean = false):Boolean

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Recursively copy the content of an origin directory to a destination directory and returns true on success.

Parameters

origin:String — The origin filename to move from.
 
destination:String — The destination filename where to move it.
 
overwrite:Boolean (default = false) — if true overwrite an already existing destination.
 
noHidden:Boolean (default = true) — if true(default) do not list hidden entries.
 
copyMode:Boolean (default = false) — if true copy also the filename mode.

Returns
Booleantrue if the directory copied successfully otherwise false.
AVM-only copyFile()method 
public static function copyFile(origin:String, destination:String, overwrite:Boolean = false, copyMode:Boolean = false):Boolean

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Copy an origin file to a destination file and returns true on success.

This method cannot handle files bigger than 2 GB, or 2147483647 bytes or MAX_INT or int.MAX_VALUE.

Parameters

origin:String — The origin filename to copy from.
 
destination:String — The destination filename to copy into.
 
overwrite:Boolean (default = false) — if true overwrite an already existing destination.
 
copyMode:Boolean (default = false) — if true copy also the filename mode.

Returns
Booleantrue if the file copied successfully otherwise false.
AVM-only copyFiles()method 
public static function copyFiles(origin:String, destination:String, filter:RegExp = null, overwrite:Boolean = false, noHidden:Boolean = true, copyMode:Boolean = false):Boolean

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Copy all files matching the filter from directory origin to destination directory and returns true on success.

This method cannot handle files bigger than 2 GB, or 2147483647 bytes or MAX_INT or int.MAX_VALUE.

Parameters

origin:String — The origin filename to copy from.
 
destination:String — The destination filename to copy into.
 
filter:RegExp (default = null) — The regular expression used to filter the results, default is /.*/ (eg. all files).
 
overwrite:Boolean (default = false) — if true overwrite an already existing destination.
 
noHidden:Boolean (default = true) — if true(default) do not copy hidden entries.
 
copyMode:Boolean (default = false) — if true copy also the filename mode.

Returns
Booleantrue if all the files copied successfully otherwise false.
AVM-only create()method 
public static function create(filename:String, useBOM:Boolean = false):void

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Creates a text file filename.

More exactly it is opening a file for writing, if it does not exists then a new file is created.

Parameters

filename:String — The filename to create.
 
useBOM:Boolean (default = false) — if true write an UTF-8 BOM.

AVM-only createByteArray()method 
public static function createByteArray(filename:String):Boolean

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Creates a binary file filename and returns true on success.

More exactly it is opening a file for writing, if it does not exists then a new file is created.

Parameters

filename:String — The filename to write.

Returns
Booleantrue if created successfully, otherwise false.
AVM-only createDirectory()method 
public static function createDirectory(filename:String):Boolean

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Creates a directory path from filename, iterates trough the path components and create the missing directories if needed.

If you only provide a single path component e. createDirectory("test") it creates a single directory in your current path.

Parameters

filename:String — The filename of the directory to create.

Returns
Booleantrue if created successfully, otherwise false.
AVM-only endsWithSeparator()method 
public static function endsWithSeparator(filename:String):Boolean

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Tests if filename ends with a separator.

Parameters

filename:String — The filename to test.

Returns
Booleantrue if filename last char is a separator, otherwise false.
AVM-only ensureEndsWithSeparator()method 
public static function ensureEndsWithSeparator(filename:String):String

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Returns filename ending with a separator.

Parameters

filename:String — The filename to verify.

Returns
String — a string which has been verified to end with a separator.
AVM-only exists()method 
public static function exists(filename:String):Boolean

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Tests whether a filename exists.

Parameters

filename:String — The filename to test.

Returns
Booleantrue if the file exists otherwise false.
AVM-only getBasenameFromPath()method 
public static function getBasenameFromPath(filename:String):String

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Returns a filepath corresponding to the last path component of this filename, either a file or a directory.

Parameters

filename:String — The filename to operate on.

Returns
String — the basename of this filename.
AVM-only getComponentsFromPath()method 
public static function getComponentsFromPath(filename:String):Array

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Returns the components of a filename.

Parameters

filename:String — The filename to operate on.

Returns
Array — AN Array of components.
AVM-only getDirectoryFromPath()method 
public static function getDirectoryFromPath(filename:String):String

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Returns the directory component of a filename without the trailing path separator, or an empty string on error.

Parameters

filename:String — The filename to operate on.

Returns
String — the filename with only its directory component.
AVM-only getDirectorySize()method 
public static function getDirectorySize(filename:String, recursive:Boolean = true, includeHidden:Boolean = true):Number

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Returns the directory filename size in bytes (adding all its files size) and if recursive add the size of any child directory entries.

Parameters

filename:String — The filename to use.
 
recursive:Boolean (default = true) — if true add the size of child directories.
 
includeHidden:Boolean (default = true) — if true include the hidden files size.

Returns
Number — a Number representing the directory size.
AVM-only getFileAccessTime()method 
public static function getFileAccessTime(filename:String):Date

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Returns the filename last access time.

The access time is the time when the data of a file was last accessed. Displaying the contents of a file or executing a shell script will update a file's atime. For example: $ cat file will update the file's atime.

Parameters

filename:String — The filename to use.

Returns
Date — a Date representing the file last access time.
AVM-only getFileChangedTime()method 
public static function getFileChangedTime(filename:String):Date

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Returns the filename last changed time.

In general it is not possible to tell the actual creation time of a file. The change time is the time when changes were made to the file or directory's inode (owner, permissions, etc.). The ctime is also updated when the contents of a file change. For example: $ chmod g+w file will update the ctime of the file.

Parameters

filename:String — The filename to use.

Returns
Date — a Date representing the file last changed time.
AVM-only getFileMode()method 
public static function getFileMode(filename:String):int

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Returns the filename mode.

Parameters

filename:String — The filename to use.

Returns
int — an int representing the file mode.
AVM-only getFileModifiedTime()method 
public static function getFileModifiedTime(filename:String):Date

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Returns the filename last modified time.

The modify time is the time when the actual contents of a file was last modified. For example: opening a text file and appending text to it, $ echo "something" >> file will update the ctime and mtime of the file.

Parameters

filename:String — The filename to use.

Returns
Date — a Date representing the file last modified time.
AVM-only getFileSize()method 
public static function getFileSize(filename:String):Number

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Returns the file filename size in bytes.

Parameters

filename:String — The filename to use.

Returns
Number — a Number representing the file size.
AVM-only getFreeDiskSpace()method 
public static function getFreeDiskSpace(filename:String):Number

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Returns the available disk space in bytes on the volume containing filename, or -1 on failure.

Parameters

filename:String — The filename to use.

Returns
Number — a Number representing the available disk space in bytes.
AVM-only getSize()method 
public static function getSize(stream:FILE):Number

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Returns the FILE stream size in bytes.

Parameters

stream:FILE — The FILE to use.

Returns
Number — a Number representing the file size.
AVM-only getTotalDiskSpace()method 
public static function getTotalDiskSpace(filename:String):Number

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Returns the total disk space in bytes on the volume containing filename, or -1 on failure.

Parameters

filename:String — The filename to use.

Returns
Number — a Number representing the total disk space in bytes.
AVM-only getUsedDiskSpace()method 
public static function getUsedDiskSpace(filename:String):Number

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Returns the used disk space in bytes on the volume containing filename, or -1 on failure.

Parameters

filename:String — The filename to use.

Returns
Number — a Number representing the used disk space in bytes.
AVM-only hasDriveLetter()method 
public static function hasDriveLetter(filename:String):Boolean

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Tests if the filename contains a drive letter.

Parameters

filename:String — The filename to test.

Returns
Booleantrue if the filename starts with [A-z]:, otherwise false.
AVM-only isDirectory()method 
public static function isDirectory(filename:String):Boolean

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Tests if the filename is a directory.

Parameters

filename:String — The filename to test.

Returns
Booleantrue if filename is a directory, otherwise false.
AVM-only isDirectoryMode()method 
public static function isDirectoryMode(mode:int):Boolean

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Tests if the mode represents a directory.

Parameters

mode:int — The mode of a filename.

Returns
Booleantrue if mode is a directory, otherwise false.
AVM-only isDotOrDotdot()method 
public static function isDotOrDotdot(entry:String):Boolean

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Tests if the entry is the current directory . or the parent directory ...

Parameters

entry:String — The file entry to test.

Returns
Booleantrue if entry is . or .., otherwise false.
AVM-only isEmptyDirectory()method 
public static function isEmptyDirectory(filename:String):Boolean

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Tests if the filename is an empty directory.

Parameters

filename:String — The filename to test.

Returns
Booleantrue if filename is an empty directory, otherwise false.
AVM-only isHidden()method 
public static function isHidden(filename:String):Boolean

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Tests if the filename is considered hidden by the system.

Parameters

filename:String — The filename to test.

Returns
Booleantrue if filename is hidden, otherwise false.
AVM-only isRegularFile()method 
public static function isRegularFile(filename:String):Boolean

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Test if the filename is a regular file.

Parameters

filename:String — The filename to test.

Returns
Booleantrue if filename is a regular file, otherwise false.
AVM-only isRegularFileMode()method 
public static function isRegularFileMode(mode:int):Boolean

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Test if the mode represents a regular file.

Parameters

mode:int — The mode of a filename.

Returns
Booleantrue if mode is a regular file, otherwise false.
AVM-only isSeparator()method 
public static function isSeparator(c:String):Boolean

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Tests if the character c is a separator.

Parameters

c:String — The char to test.

Returns
Booleantrue if char is a separator, otherwise false.
AVM-only isValid()method 
public static function isValid(filename:String):Boolean

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Tests if the filename is valid under the current system rules.

Parameters

filename:String — The filename to test.

Returns
Booleantrue if component is valid, otherwise false.
AVM-only isValidComponent()method 
public static function isValidComponent(component:String):Boolean

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Tests if the component is valid under the current system rules.

Parameters

component:String — The component to test.

Returns
Booleantrue if component is valid, otherwise false.
AVM-only isValidEverywhere()method 
public static function isValidEverywhere(filename:String):Boolean

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Tests if the filename is valid under all file system rules.

Parameters

filename:String — The filename to test.

Returns
Booleantrue if component is valid, otherwise false.
AVM-only isValidEverywhereComponent()method 
public static function isValidEverywhereComponent(component:String):Boolean

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Tests if the component is valid under all file system rules.

Parameters

component:String — The component to test.

Returns
Booleantrue if component is valid, otherwise false.
AVM-only isValidLinuxComponent()method 
public static function isValidLinuxComponent(component:String):Boolean

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Tests if the component is valid under Linux file system rules.

Parameters

component:String — The component to test.

Returns
Booleantrue if component is valid, otherwise false.
AVM-only isValidMacintoshComponent()method 
public static function isValidMacintoshComponent(component:String):Boolean

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Tests if the component is valid under Macintosh file system rules.

Parameters

component:String — The component to test.

Returns
Booleantrue if component is valid, otherwise false.
AVM-only isValidWindowsComponent()method 
public static function isValidWindowsComponent(component:String):Boolean

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Tests if the component is valid under Windows file system rules.

Parameters

component:String — The component to test.

Returns
Booleantrue if component is valid, otherwise false.
AVM-only listByBreadth()method 
public static function listByBreadth(filepath:String, includePath:Boolean = false, noHidden:Boolean = true, sorting:int = -1):Array

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Returns an array of files and directories sorted by breadth.

Parameters

filepath:String — The filename from where to list.
 
includePath:Boolean (default = false) — Include the original filepath in the results.
 
noHidden:Boolean (default = true) — if true(default) do not list hidden entries.
 
sorting:int (default = -1) — negative (default) does not sort, if positive, use Array class constant to sort the entries.

Returns
Array — an array of directories.
AVM-only listByDepth()method 
public static function listByDepth(filepath:String, includePath:Boolean = false, noHidden:Boolean = true, sorting:int = -1):Array

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Returns an array of files and directories sorted by depth.

Parameters

filepath:String — The filename from where to list.
 
includePath:Boolean (default = false) — Include the original filepath in the results.
 
noHidden:Boolean (default = true) — if true(default) do not list hidden entries.
 
sorting:int (default = -1) — negative (default) does not sort, if positive, use Array class constant to sort the entries.

Returns
Array — an array of directories.
AVM-only listDirectories()method 
public static function listDirectories(filepath:String, noDots:Boolean = true, noHidden:Boolean = true, sorting:int = -1):Array

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Returns an array of directories from filename.

Parameters

filepath:String — The filename from where to list.
 
noDots:Boolean (default = true) — if true(default) do not list . and ...
 
noHidden:Boolean (default = true) — if true(default) do not list hidden entries.
 
sorting:int (default = -1) — negative (default) does not sort, if positive, use Array class constant to sort the entries.

Returns
Array — an array of directories.
AVM-only listDirectoriesWithFilter()method 
public static function listDirectoriesWithFilter(filepath:String, filter:Function, noDots:Boolean = true, noHidden:Boolean = true, sorting:int = -1):Array

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Returns an array of directories from filename filtered by a function.

Parameters

filepath:String — The filename from where to list.
 
filter:Function — The function used to filter the results.
 
noDots:Boolean (default = true) — if true(default) do not list . and ...
 
noHidden:Boolean (default = true) — if true(default) do not list hidden entries.
 
sorting:int (default = -1) — negative (default) does not sort, if positive, use Array class constant to sort the entries.

Returns
Array — an array of directories.
AVM-only listDirectoriesWithRegexp()method 
public static function listDirectoriesWithRegexp(filepath:String, filter:RegExp, noDots:Boolean = true, noHidden:Boolean = true, sorting:int = -1):Array

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Returns an array of directories from filename filtered by a regular expression.

Parameters

filepath:String — The filename from where to list.
 
filter:RegExp — The regular expression used to filter the results.
 
noDots:Boolean (default = true) — if true(default) do not list . and ...
 
noHidden:Boolean (default = true) — if true(default) do not list hidden entries.
 
sorting:int (default = -1) — negative (default) does not sort, if positive, use Array class constant to sort the entries.

Returns
Array — an array of directories.
AVM-only listFiles()method 
public static function listFiles(filepath:String, noDots:Boolean = true, noHidden:Boolean = true, sorting:int = -1):Array

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Returns an array of files from filename.

Parameters

filepath:String — The filename from where to list.
 
noDots:Boolean (default = true) — if true(default) do not list . and ...
 
noHidden:Boolean (default = true) — if true(default) do not list hidden entries.
 
sorting:int (default = -1) — negative (default) does not sort, if positive, use Array class constant to sort the entries.

Returns
Array — an array of files.
AVM-only listFilesOrDirectories()method 
public static function listFilesOrDirectories(filepath:String, noDots:Boolean = true, noHidden:Boolean = true, sorting:int = -1):Array

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Returns an array of files and directories from filename.

Parameters

filepath:String — The filename from where to list.
 
noDots:Boolean (default = true) — if true(default) do not list . and ...
 
noHidden:Boolean (default = true) — if true(default) do not list hidden entries.
 
sorting:int (default = -1) — negative (default) does not sort, if positive, use Array class constant to sort the entries.

Returns
Array — an array of files and directories.
AVM-only listFilesOrDirectoriesWithFilter()method 
public static function listFilesOrDirectoriesWithFilter(filepath:String, filter:Function, noDots:Boolean = true, noHidden:Boolean = true, sorting:int = -1):Array

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Returns an array of files and directories from filename filtered by a function.

Parameters

filepath:String — The filename from where to list.
 
filter:Function — The function used to filter the results.
 
noDots:Boolean (default = true) — if true(default) do not list . and ...
 
noHidden:Boolean (default = true) — if true(default) do not list hidden entries.
 
sorting:int (default = -1) — negative (default) does not sort, if positive, use Array class constant to sort the entries.

Returns
Array — an array of files and directories.
AVM-only listFilesOrDirectoriesWithRegexp()method 
public static function listFilesOrDirectoriesWithRegexp(filepath:String, filter:RegExp, noDots:Boolean = true, noHidden:Boolean = true, sorting:int = -1):Array

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Returns an array of files and directories from filename filtered by a regular expression.

Parameters

filepath:String — The filename from where to list.
 
filter:RegExp — The regular expression used to filter the results.
 
noDots:Boolean (default = true) — if true(default) do not list . and ...
 
noHidden:Boolean (default = true) — if true(default) do not list hidden entries.
 
sorting:int (default = -1) — negative (default) does not sort, if positive, use Array class constant to sort the entries.

Returns
Array — an array of files and directories.
AVM-only listFilesWithFilter()method 
public static function listFilesWithFilter(filepath:String, filter:Function, noDots:Boolean = true, noHidden:Boolean = true, sorting:int = -1):Array

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Returns an array of files from filename filtered by a function.

Parameters

filepath:String — The filename from where to list.
 
filter:Function — The function used to filter the results.
 
noDots:Boolean (default = true) — if true(default) do not list . and ...
 
noHidden:Boolean (default = true) — if true(default) do not list hidden entries.
 
sorting:int (default = -1) — negative (default) does not sort, if positive, use Array class constant to sort the entries.

Returns
Array — an array of files.

Example
Usage
         import shell.FileSystem.*;
         
         //our filter function
         var isATextFile:Function = function( element:*, index:int, arr:Array ):Boolean
         {
                 if( element.indexOf( ".txt" ) > -1 )
                 {
                     return true;
                 }
         
                 return false;
         }
         
         //get a list of files and apply the filter
         var myfiles:Array = FileSystem.listFilesWithFilter( "test", isATextFile );
                  //will show a list of files ending by ".txt"
         trace( myfiles.join( "\n" ) );
         
         
AVM-only listFilesWithRegexp()method 
public static function listFilesWithRegexp(filepath:String, filter:RegExp, noDots:Boolean = true, noHidden:Boolean = true, sorting:int = -1):Array

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Returns an array of files from filename filtered by a regular expression.

Parameters

filepath:String — The filename from where to list.
 
filter:RegExp — The regular expression used to filter the results.
 
noDots:Boolean (default = true) — if true(default) do not list . and ...
 
noHidden:Boolean (default = true) — if true(default) do not list hidden entries.
 
sorting:int (default = -1) — negative (default) does not sort, if positive, use Array class constant to sort the entries.

Returns
Array — an array of files.

Example
Usage
         import shell.FileSystem.*;
         
         //list all files ending with extension "*.abc"
         var myfiles:Array = FileSystem.listFilesWithRegexp( "test", /.*\.abc$/ );
         
         trace( myfiles.join( "\n" ) );
         
         
AVM-only move()method 
public static function move(origin:String, destination:String, overwrite:Boolean = false, force:Boolean = false):Boolean

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Moves an origin entry (file or directory) to a destination entry and returns true on success.

You can only move file to file or directory to directory in case of mismatch it will returns false.

A move() is almost like a rename(), but if the rename does not work the method will try to copy first then followed by a delete, and in this case the copy could work but it will returns false if the delete does not.

Parameters

origin:String — The origin filename to move from.
 
destination:String — The destination filename where to move it.
 
overwrite:Boolean (default = false) — if true overwrite an already existing destination.
 
force:Boolean (default = false) — if true and if the rename fail will try to do a copy and delete instead, works only with directories.

Returns
Booleantrue if the filename moved successfully otherwise false.
AVM-only nativeRead()method 
public static function nativeRead(filename:String):String

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Reads the file filename into memory and returns it as a String.

Supports UTF-8 files with or without BOM, as well as UTF-16 files.

Does not support UTF-8 filename under Windows.

Parameters

filename:String — The filename to read.

Returns
String — the string data contained in the filename.
AVM-only nativeReadByteArray()method 
public static function nativeReadByteArray(filename:String):ByteArray

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Reads the binary file filename into memory and returns it as a ByteArray.

Does not support UTF-8 filename under Windows.

Parameters

filename:String — The filename to read.

Returns
ByteArray — the ByteArray data contained in the filename.
AVM-only nativeWrite()method 
public static function nativeWrite(filename:String, data:String):void

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Writes the text data to the file filename.

Does not support UTF-8 filename under Windows.

Parameters

filename:String — The filename to write.
 
data:String — the string data to write into the file.

AVM-only nativeWriteByteArray()method 
public static function nativeWriteByteArray(filename:String, bytes:ByteArray):Boolean

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Writes the binary bytes to the file filename and returns true on success.

Does not support UTF-8 filename under Windows.

Parameters

filename:String — The filename to write.
 
bytes:ByteArray — the binary data to write into the file.

Returns
Booleantrue if wirtten successfully, otherwise false.
AVM-only normalizePath()method 
public static function normalizePath(filename:String):String

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Normalizes the separators of the filename.

Parameters

filename:String — The filename to transform.

Returns
String — the filename as an normalized path (all separators are the same).
AVM-only read()method 
public static function read(filename:String):String

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Reads the file filename into memory and returns it as a String.

Supports UTF-8 files with or without BOM, as well as UTF-16 files.

This method cannot handle files bigger than 2 GB, or 2147483647 bytes or MAX_INT or int.MAX_VALUE.

Parameters

filename:String — The filename to read.

Returns
String — the string data contained in the filename.
AVM-only readByteArray()method 
public static function readByteArray(filename:String):ByteArray

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Reads the binary file filename into memory and returns it as a ByteArray.

This method cannot handle files bigger than 2 GB, or 2147483647 bytes or MAX_INT or int.MAX_VALUE.

Parameters

filename:String — The filename to read.

Returns
ByteArray — the ByteArray data contained in the filename.
AVM-only remove()method 
public static function remove(filename:String, recursive:Boolean = false):void

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Removes an entry (file or directory) from the file system.

Parameters

filename:String — The filename to remove.
 
recursive:Boolean (default = false) — if true and filename is a directory delete all child entries first.

AVM-only removeDirectory()method 
public static function removeDirectory(filename:String, recursive:Boolean = false):void

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Removes a directory entry from the file system, if recursive=true delete all child entries (files and directories) first.

Parameters

filename:String — The filename to remove.
 
recursive:Boolean (default = false) — if true delete all child entries first.

AVM-only removeFile()method 
public static function removeFile(filename:String):void

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Removes a file entry from the file system.

Parameters

filename:String — The filename to remove.

AVM-only stripTrailingSeparators()method 
public static function stripTrailingSeparators(filename:String):String

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Remove trailing separators from the filename.

Parameters

filename:String — The filename to verify.

Returns
String — a string which end has been stripped of any separators.
AVM-only write()method 
public static function write(filename:String, data:String, useBOM:Boolean = false):void

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Writes the text data to the file filename.

Parameters

filename:String — The filename to write.
 
data:String — the string data to write into the file.
 
useBOM:Boolean (default = false) — if true write an UTF-8 BOM.

AVM-only writeByteArray()method 
public static function writeByteArray(filename:String, bytes:ByteArray):Boolean

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Writes the binary bytes to the file filename and returns true on success.

Parameters

filename:String — The filename to write.
 
bytes:ByteArray — the binary data to write into the file.

Returns
Booleantrue if written successfully, otherwise false.
Constant Detail
AVM-only currentDirectoryConstant
public static const currentDirectory:String = "."

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

A special path component meaning "this directory".

AVM-only extensionSeparatorConstant 
public static const extensionSeparator:String = "."

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

The character used to identify a file extension.

AVM-only parentDirectoryConstant 
public static const parentDirectory:String = ".."

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

A special path component meaning "the parent directory".