<div class="meta" robots="noindex">

</div>

Class

# Xojo.IO.FolderItem

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

<div class="warning">

<div class="title">

Warning

</div>

This item was deprecated in version 2020r2. Please use `FolderItem</api/files/folderitem>` as a replacement.

</div>

## Description

The FolderItem class represents files, applications, folders and other items in the file system.

## Properties

<div class="rst-class">

table-centered_columns_3_and_4

</div>

| Name                                                        | Type                                                  | Read-Only | Shared |
|-------------------------------------------------------------|-------------------------------------------------------|-----------|--------|
| `Count<xojo.io.folderitem.count>`                           | `UInteger</api/data_types/additional_types/uinteger>` | ✓         |        |
| `CreationDate<xojo.io.folderitem.creationdate>`             | `Date</api/deprecated/date>`                          |           |        |
| `DisplayName<xojo.io.folderitem.displayname>`               | `Text</api/deprecated/text>`                          | ✓         |        |
| `Exists<xojo.io.folderitem.exists>`                         | `Boolean</api/data_types/boolean>`                    | ✓         |        |
| `IsAlias<xojo.io.folderitem.isalias>`                       | `Boolean</api/data_types/boolean>`                    | ✓         |        |
| `IsExtensionVisible<xojo.io.folderitem.isextensionvisible>` | `Boolean</api/data_types/boolean>`                    | ✓         |        |
| `IsFolder<xojo.io.folderitem.isfolder>`                     | `Boolean</api/data_types/boolean>`                    | ✓         |        |
| `IsReadable<xojo.io.folderitem.isreadable>`                 | `Boolean</api/data_types/boolean>`                    | ✓         |        |
| `IsVisible<xojo.io.folderitem.isvisible>`                   | `Boolean</api/data_types/boolean>`                    | ✓         |        |
| `IsWriteable<xojo.io.folderitem.iswriteable>`               | `Boolean</api/data_types/boolean>`                    | ✓         |        |
| `Length<xojo.io.folderitem.length>`                         | `UInt64</api/data_types/additional_types/uint64>`     | ✓         |        |
| `ModificationDate<xojo.io.folderitem.modificationdate>`     | `Date</api/deprecated/date>`                          |           |        |
| `Name<xojo.io.folderitem.name>`                             | `Text</api/deprecated/text>`                          |           |        |
| `Parent<xojo.io.folderitem.parent>`                         | `FolderItem</api/files/folderitem>`                   | ✓         |        |
| `Path<xojo.io.folderitem.path>`                             | `Text</api/deprecated/text>`                          | ✓         |        |
| `URLPath<xojo.io.folderitem.urlpath>`                       | `Text</api/deprecated/text>`                          | ✓         |        |

## Methods

<div class="rst-class">

table-centered_column_4

</div>

| Name                                                | Parameters                                                                                                                | Returns                             | Shared |
|-----------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------|-------------------------------------|--------|
| `Child<xojo.io.folderitem.child>`                   | name As `String</api/data_types/string>`, resolveAlias As `Boolean</api/data_types/boolean>` = `True</api/language/true>` | `FolderItem</api/files/folderitem>` |        |
| `Children<xojo.io.folderitem.children>`             | resolveAlias As `Boolean</api/data_types/boolean>` = `True</api/language/true>`                                           | `Iterable</api/language/iterable>`  |        |
| `Constructor<xojo.io.folderitem.constructor0>`      | path As `String</api/data_types/string>`, resolveAlias As `Boolean</api/data_types/boolean>` = `True</api/language/true>` |                                     |        |
| `CopyTo<xojo.io.folderitem.copyto>`                 | destination As `FolderItem</api/files/folderitem>`                                                                        |                                     |        |
| `CreateAsFolder<xojo.io.folderitem.createasfolder>` |                                                                                                                           |                                     |        |
| `Delete<xojo.io.folderitem.delete>`                 |                                                                                                                           |                                     |        |
| `MoveTo<xojo.io.folderitem.moveto>`                 | destination As `FolderItem</api/files/folderitem>`                                                                        |                                     |        |

## Property descriptions

<div id="xojo.io.folderitem.count">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Xojo.IO.FolderItem.Count

**Count** As `UInteger</api/data_types/additional_types/uinteger>`

The number of items in the FolderItem if it is a folder. If the item is not a folder then it returns 0.

This property is read-only.

Get the count of files in the folder:

``` xojo
Var f As FolderItem = SpecialFolder.Documents
Var count As Integer = f.Count
```

<div id="xojo.io.folderitem.creationdate">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Xojo.IO.FolderItem.CreationDate

**CreationDate** As `Date</api/deprecated/date>`

The creation date of the FolderItem.

In order to change the creation date, you need to create a new Date and then assign it to this property. Changing the CreationDate property directly will not cause the date to actually get changed.

<div class="warning">

<div class="title">

Warning

</div>

A `RuntimeException</api/exceptions/runtimeexception>` will be raised if the creation date can not be changed when attempting to set a new date.

</div>

Get the creation date:

``` xojo
Var createDate As Xojo.Core.Date
createDate = myFile.CreationDate
```

To change the creation date:

``` xojo
Var newDate As New Xojo.Core.Date(2014, 8, 1)
myFile.CreationDate = newDate
```

<div id="xojo.io.folderitem.displayname">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Xojo.IO.FolderItem.DisplayName

**DisplayName** As `Text</api/deprecated/text>`

The name of the FolderItem as it should be displayed to the user. This is usually the same as the Name property, but you should always use DisplayName rather than Name when displaying the name of the FolderItem to the user.

This property is read-only.

Get the display name:

``` xojo
Var name As String
name = myFile.DisplayName
```

<div id="xojo.io.folderitem.exists">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Xojo.IO.FolderItem.Exists

**Exists** As `Boolean</api/data_types/boolean>`

Indicates whether the FolderItem exists.

This property is read-only.

You can create a FolderItem that does not refer to actual existing file on disk. When you do so, this property returns False.

To check if a file exists:

``` xojo
Var f As New Xojo.IO.FolderItem("test.txt")

If f.Exists Then
  ' open the file
End If
```

<div id="xojo.io.folderitem.isalias">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Xojo.IO.FolderItem.IsAlias

**IsAlias** As `Boolean</api/data_types/boolean>`

Indicates whether the FolderItem is a link or shortcut to another Folderitem.

This property is read-only.

<div id="xojo.io.folderitem.isextensionvisible">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Xojo.IO.FolderItem.IsExtensionVisible

**IsExtensionVisible** As `Boolean</api/data_types/boolean>`

Tells you whether the file should have its extension visible or hidden based on the user's OS settings.

This property is read-only.

<div id="xojo.io.folderitem.isfolder">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Xojo.IO.FolderItem.IsFolder

**IsFolder** As `Boolean</api/data_types/boolean>`

Indicates if the FolderItem is a folder.

This property is read-only.

<div id="xojo.io.folderitem.isreadable">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Xojo.IO.FolderItem.IsReadable

**IsReadable** As `Boolean</api/data_types/boolean>`

This is True when you have permissions to read from the file or folder. In the case of a folder, it means you can read the contents of the folder.

This property is read-only.

Even if IsReadable is True, it does not provide a guarantee tha the read will succeed. If you want to read from a file, you should attempt to do so and handle any exceptions that may occur.

<div id="xojo.io.folderitem.isvisible">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Xojo.IO.FolderItem.IsVisible

**IsVisible** As `Boolean</api/data_types/boolean>`

ndicates whether the FolderItem is visible to standard file system tools (Explorer or Finder, for example).

This property is read-only.

``` xojo
If myFile.Visible Then
  ' open the file
End If
```

<div id="xojo.io.folderitem.iswriteable">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Xojo.IO.FolderItem.IsWriteable

**IsWriteable** As `Boolean</api/data_types/boolean>`

This is True when you have permissions to write to the file or folder. In the case of a folder, it means you can create files in the folder.

This property is read-only.

Even if IsWriteable is True, an attempt to write may fail for other reasons, such as coding errors or insufficient disk space. For example, a write may fail because disk space runs out midway through the write operation. IsWriteable is not intended to check for these type of conditions. If you intend to write to a file, you should attempt to do so and handle any exceptions that may occur.

<div id="xojo.io.folderitem.length">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Xojo.IO.FolderItem.Length

**Length** As `UInt64</api/data_types/additional_types/uint64>`

The size of the file in bytes. For folders, the size is 0.

This property is read-only.

Gets the length of a file:

``` xojo
Var f As FolderItem = SpecialFolder.Documents("MyFile.txt")
If f.Exists Then
  Var length As UInt64 = f.Length
End If
```

<div id="xojo.io.folderitem.modificationdate">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Xojo.IO.FolderItem.ModificationDate

**ModificationDate** As `Date</api/deprecated/date>`

The modification date of the FolderItem.

In order to change the modification date, you need to create a new Date and then assign it to this property. Changing the ModificationDate property directly will not cause the date to actually get changed.

Get the modification date:

``` xojo
Var modDate As Xojo.Core.Date
modDate = myFile.ModificationDate
```

To change the modification date:

``` xojo
Var newDate As New Xojo.Core.Date(2014, 8, 1)
myFile.ModificationDate = newDate
```

<div id="xojo.io.folderitem.name">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Xojo.IO.FolderItem.Name

**Name** As `Text</api/deprecated/text>`

The name of the FolderItem. Changing this name renames the file or folder.

Renames a file:

``` xojo
Dim f As FolderItem = SpecialFolder.Documents("MyFile.txt")
f.Name = "NewFile.txt" ' renames file
```

<div id="xojo.io.folderitem.parent">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Xojo.IO.FolderItem.Parent

**Parent** As `FolderItem</api/files/folderitem>`

This is the parent folder of the FolderItem (based on the file system hierarchy). If the Parent is the root of the file system, this returns Nil.

This property is read-only.

``` xojo
Dim f As FolderItem = SpecialFolder.Documents
Dim parent As FolderItem = f.Parent
```

<div id="xojo.io.folderitem.path">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Xojo.IO.FolderItem.Path

**Path** As `Text</api/deprecated/text>`

The full path to the FolderItem using the path format native to the OS.

This property is read-only.

On macOS, iOS and Linux, this returns the POSIX path (separated by slashes).

If the FolderItem is a folder, the Path ends with a backslash on Windows and a forward slash on Linux.

When accessing a drive on Windows that you do not have permissions for or one that does not exist, there is no trailing slash. For example, "f:" is a drive that is not mounted, "f:" is mounted.

Get the full path of a file:

``` xojo
Dim fullPath As Text = myFolderItem.Path
```

<div id="xojo.io.folderitem.urlpath">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Xojo.IO.FolderItem.URLPath

**URLPath** As `Text</api/deprecated/text>`

The URL path of the FolderItem, which uses the form **file://path/to/file**. It can be used to load a local file into an HTML viewer.

This property is read-only.

Get the URL path for a file:

``` xojo
Dim urlPath As Text = myFolderItem.URLPath
```

## Method descriptions

<div id="xojo.io.folderitem.child">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Xojo.IO.FolderItem.Child

**Child**(name As `String</api/data_types/string>`, resolveAlias As `Boolean</api/data_types/boolean>` = `True</api/language/true>`) As `FolderItem</api/files/folderitem>`

Returns a FolderItem with the specified name that represents a file or folder within the FolderItem.

Gets a specific file in the Documents folder:

``` xojo
Using Xojo.IO
Var docs As FolderItem
docs = SpecialFolder.Documents
Var docFile As FolderItem = docs.Child("MyFile.txt")
```

<div id="xojo.io.folderitem.children">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Xojo.IO.FolderItem.Children

**Children**(resolveAlias As `Boolean</api/data_types/boolean>` = `True</api/language/true>`) As `Iterable</api/language/iterable>`

Returns an iterator which can be used with a For Each...Next loop to go through all the files in a folder.

Get all the files in the Documents folder and add their names to an array:

``` xojo
Using Xojo.IO
Var docs As FolderItem
docs = SpecialFolder.Documents

Var files() As Text
For Each f As FolderItem In docs.Children
  files.AddRow(f.Name)
Next
```

<div id="xojo.io.folderitem.constructor0">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Xojo.IO.FolderItem.Constructor

**Constructor**(path As `String</api/data_types/string>`, resolveAlias As `Boolean</api/data_types/boolean>` = `True</api/language/true>`)

<div class="note">

<div class="title">

Note

</div>

`Constructors</api/language/constructor>` are special methods called when you create an object with the `New</api/language/new>` keyword and pass in the parameters above.

</div>

Creates a new FolderItem using an absolute path.

Create a FolderItem that points to a file in a folder in the root of the drive:

``` xojo
Var saveFile As New FolderItem("c:\data\savefile.txt")
```

To create a <span class="title-ref">Xojo.IO.FolderItem</span> from a FolderItem returned from a classic framework class or method:

``` xojo
Var userFile As FolderItem = GetOpenFolderItem("")
Var newFile As New Xojo.IO.FolderItem(userFile.NativePath.ToText)
```

<div id="xojo.io.folderitem.copyto">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Xojo.IO.FolderItem.CopyTo

**CopyTo**(destination As `FolderItem</api/files/folderitem>`)

Copies the FolderItem to the specified destination Folderitem.

If destination is a folder, then the FolderItem is copied into the folder.

If destination is a file and the file exists, the copy is cancelled and a RuntimeException is raised. You'll need to first delete the destination file before copying the original.

If the source FolderItem is a folder, then the folder and all its contents are recursively copied.

<div class="warning">

<div class="title">

Warning

</div>

A `RuntimeException</api/exceptions/runtimeexception>` will be raised when the destination is a file and the file exists.

</div>

Copy a file:

``` xojo
Using Xojo.IO
Var sourceFile As FolderItem = SpecialFolder.Documents.Child("MyFile.txt")

If sourceFile.Exists Then
  Var destFile As FolderItem = SpecialFolder.Documents.Child(sourceFile.Name + " copy")
  sourceFile.CopyTo(destFile)
End If
```

<div id="xojo.io.folderitem.createasfolder">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Xojo.IO.FolderItem.CreateAsFolder

**CreateAsFolder**

Creates a folder at the location of the FolderItem.

Create a new folder:

``` xojo
Using Xojo.IO
Var f As FolderItem = SpecialFolder.Documents.Child("MyFolder")
f.CreateAsFolder
```

<div id="xojo.io.folderitem.delete">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Xojo.IO.FolderItem.Delete

**Delete**

Deletes the file or folder specified by the FolderItem.

This method irreversibly removes the file or directory from the volumes it is stored on. It does not put things in the "trash". Folders must be empty before they can be deleted.

== Exceptions == .. warning:: A `RuntimeException</api/exceptions/runtimeexception>` will be raised if the FolderItem cannot be deleted. This could occur because the file is in use, the file is locked, the folder is not empty or the volume, file or folder is not longer available.

Delete a file:

``` xojo
Using Xojo.IO
Var f As FolderItem = SpecialFolder.Documents.Child("MyFile.txt")

If f.Exists Then
  f.Delete
End If
```

<div id="xojo.io.folderitem.moveto">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Xojo.IO.FolderItem.MoveTo

**MoveTo**(destination As `FolderItem</api/files/folderitem>`)

Moves the FolderItem to the specified destination Folderitem.

This method does a move rather than a copy even when the source is on a different volume than the destination. After the move, the Exists property of the original FolderItem is False.

If the source FolderItem is a folder, then the folder and all its contents are recursively copied.

The destination parameter is a file, not a folder.

<div class="warning">

<div class="title">

Warning

</div>

A `RuntimeException</api/exceptions/runtimeexception>` will be raised if the FolderItem could not be moved, for example if the destination is a file and it already exists.

</div>

Move a file to a new location:

``` xojo
Using Xojo.IO
Var sourceFile As FolderItem = SpecialFolder.Documents.Child("MyFile.txt")

If sourceFile.Exists Then
  Var destFile As FolderItem = SpecialFolder.ApplicationSupport.Child(sourceFile.Name)
  sourceFile.MoveTo(destFile)
End If
```

## Notes

Implements Xojo.Core.Iterable.

On iOS, to get a reference to a FolderItem, use SpecialFolder. For example:

``` xojo
Var file As FolderItem = SpecialFolder.Documents("MyFile.txt")
```

To convert a classic FolderItem to a <span class="title-ref">Xojo.IO.FolderItem</span>, use the Constructor like this:

``` xojo
Var classicFile As FolderItem = GetFolderItem("")
Var newFile As New Xojo.IO.FolderItem(classicFile.NativePath.ToText)
```

To convert <span class="title-ref">Xojo.IO.FolderItem</span> to a classic FolderItem:

``` xojo
Var newFile As Xojo.IO.FolderItem = Xojo.IO.SpecialFolder.GetResource("MyFile.txt")
Var classicFile As New FolderItem(newFile.Path, FolderItem.PathTypeNative)
```

## Compatibility

All project types on all supported operating systems.

## See also

`Object</api/data_types/additional_types/object>` parent class; `TextInputStream</api/files/textinputstream>`, `BinaryStream</api/files/binarystream>` classes; `SpecialFolder</api/files/specialfolder>` module
