FolderItem
Class: FolderItem

Method PrototypeDescription
Property AbsolutePath As String (read only)Gives the full path of the FolderItem. The root directory will be the site-root and not the system's root directory.
Property Alias As Boolean (read only)True if an alias, otherwise false. Aliases automatically get resolved, unless on Windows. To access the actual alias, use the methods TrueChild() or TrueItem().
Property Count As Integer (read only)The number of items in the FolderItem if it is a directory, otherwise 0.
Property CreationDate As Date (read only)The creation date of the FolderItem.
Property Directory As Boolean (read only)True if the FolderItem is a directory, otherwise False.
Property Exists As Boolean (read only)True if the FolderItem exists, otherwise False.
Property ExtensionVisible As Boolean (read/write)True if the FolderItem's extension is visible, otherwise False. Mac OS X only.
Property Group As String (read/write)The associated group for the FolderItem.
Property IsReadable As Boolean (read only)True if the FolderItem is readable, otherwise False. Mac OS X only.
Property IsWriteable As Boolean (read only)True if the FolderItem is writable, otherwise False.
Property LastErrorCode As Integer (read only)The Last Error code, otherwise 0.
Property Length As UInt64 (read only)The length of the file (in bytes).
Property Locked As Boolean (read/write)True if the FolderItem is locked, otherwise False. Mac OS X only
Property MacCreator As String (read/write)The 4-byte creator code that is stored in a FolderItem's resource fork. Mac OS X only.
Property MacDirID As Integer (read only)The directory ID of a FolderItem. Mac OS X only.
Property MacType As String (read/write)The 4-byte type code that is stored in a FolderItem's resource fork. Mac OS X only.
Property MacVrefNum As Integer (read only)The Volume Reference Number for a FolderItem. Mac OS X only.
Property ModificationDate As Date (read/write)The modification date of the FolderItem.
Property Name As String (read/write)The name of the FolderItem. If you set it to a different name, it is equivalent to method MoveFileTo().
Property Owner As String (read only)The owner of the FolderItem.
Property Parent As FolderItem (read only)The parent folder of FolderItem in the file system.
Property Permissions As Integer (read/write)The 3-digit permissions code of a FolderItem. Unix and OS X only. Note: Permission codes are in an Octal base as opposed to decimal base, otherwise they are similar to normal Unix based permissions.
Property ResourceForkLength As Integer (read only)The Length of the Resource Fork (in bytes). Mac OS X only.
Property ShellPath As String (read only)The shell path of a FolderItem. On Mac OS X and Linux this is the POSIX path.
Property Type As String (read only)The type of FolderItem, if it is not a Directory. Mac OS X only.
Property URLPath As String (read only)The URL path of FolderItem.
Property VirtualVolume As VirtualVolume (read/write)A VirtualVolume if FolderItem is a VirtualVolume, otherwise nil.
Property Visible As Boolean (read/write)True if the FolderItem is visible, otherwise False. Mac OS X only.

Method AppendToTextFile() As TextOutputStreamCreates a TextOutputStream from FolderItem. Text files only.
Method Child(filename As String) As FolderItemIf the current FolderItem is a directory, it returns a folder or file with the name filename.
Sub Constructor( path As String )Initialize a new FolderItem to the given path.
Sub CopyFileTo(target As FolderItem)Copies the current FolderItem to target.
Sub CreateAsFolder()Creates a folder from FolderItem.
Method CreateBinaryFile( fileType As String = "" ) As BinaryStreamCreates a BinaryStream with the type fileType from the FolderItem.
Method CreateTextFile() As TextOutputStreamCreates a TextInputStream from the FolderItem. Text files only.
Method CreateVirtualVolume() As VirtualVolumeCreates a VirtualVolume from the FolderItem.
Sub Delete()Deletes the FolderItem.
Method GetFolderItem( path As String ) As FolderItemThe same as the constructor.
Method GetRelative( saveInfo As String ) As FolderItemReturns a FolderItem based on the relative path that was created with the return value from GetSaveInfo().
Method GetSaveInfo( relativeTo As FolderItem, mode As Integer = 0 ) As StringReturns the relative Path.
Method Item( N As Integer) As FolderItemReturns the Nth (array starts with index 1, not 0) file of the FolderItem, assuming FolderItem is a directory.
Sub MoveFileTo(target As FolderItem)Moves the current FolderItem to target
Method OpenAsBinaryFile( readWrite As Boolean = false ) As BinaryStreamOpens a BinaryStream from the FolderItem. The stream will open as read only, unless True is given.
Method OpenAsTextFile() As TextInputStreamOpens a TextInputStream from the FolderItem. Text files only.
Method OpenAsVirtualVolume() As VirtualVolumeOpens a VirtualVolume from the FolderItem.
Method RelativePath() As StringReturns the relative Path from the site-root.
Method TrueChild( pathName As String ) As FolderItemSimilar to Child(), except if pathName is an alias, it will return the actual alias.
Method TrueItem( N As Integer ) As FolderItemSimilar to Item(), except if the Nth item is an alias, it will return the actual alias.


FolderItem is used to represent files and folders on the filesystem. To create a FolderItem object, use the constructor or the GetFolderItem method. To access sub-folders or files within a folder, use the Child, Item, TrueChild or TrueItem methods. Note that Yuma's root directory is the website root, not the file system's root.

The parameter to both GetFolderItem and the FolderItem Constructor is a URL-style path relative to the web server document root. That is, a number of directory/file names (or ".." to mean "up one directory") separated by forward slashes. So for example, "foo/bar.txt" refers to the file "bar.txt" inside the "foo" subdirectory of the document root. To refer to the document root itself, you would use the empty string ("") as the path.


Differences from REALbasic:
Yuma doesn't support the properties DesktopFolder, DisplayName, SharedTrashFolder, TemporaryFolder and TrashFolder.

Yuma doesn't support the methods CreateMovie, CreateResourceFork, Launch, OpenAsVectorPicture, OpenEditableMovie, OpenResourceFork, OpenResourceMovie, OpenStyledEditField, SaveAsJPEG, SaveAsPicture and SaveStyledEditField.

Yuma doesn't support the pathType constant or the Picture Formats.

Yuma doesn't support the Volume() function.

Yuma doesn't support the SpecialFolder module.