# FileUtility class

Namespace: [Grasshopper2.Doc](https://developer.rhino3d.com/api/gh2/namespace/grasshopper2.doc.md) · Assembly: [Grasshopper2](https://developer.rhino3d.com/api/gh2/assembly/grasshopper2.md)

```cs
public class FileUtility
```

This class maintains all information and functionality regarding document files.

## Constructors

- [FileUtility](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.fileutility/ctor.md): Construct a new document file state class.

## Properties

- [AutoSaveFilePath](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.fileutility/autosavefilepath.md): Gets the file path to the autosave file, or null if that's currently not possible.
- [BackupMethod](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.fileutility/backupmethod.md): Gets or sets the backup behaviour for this document.
- [BackupTimestamp](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.fileutility/backuptimestamp.md): Gets or sets the timestamp formatting to be used when backing up files which are about to be overwritten due to a Save operation.
- [BackupTimestampWithFallback](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.fileutility/backuptimestampwithfallback.md): Gets the user overridden time stamp format, or the default if the value has not been overridden.
- [BackupUserFolder](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.fileutility/backupuserfolder.md): Gets or sets the backup folder for when the [FileUtility.BackupMethod](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.fileutility/backupmethod.md) equals [BackupMethod.UserFolder](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.backupmethod.md).
- [Directory](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.fileutility/directory.md): Gets the directory of the current path, if any.
- [DisplayText](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.fileutility/displaytext.md): Gets the text used to describe this document. The DisplayText may contain the filename and the saved state, as well as hierarchical clues.
- [FallbackName](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.fileutility/fallbackname.md): Gets or sets the fallback name. If the file is otherwise unsaved, the fallback name (if set) will be used instead of "unnamed".
- [FileName](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.fileutility/filename.md): Gets the filename (without the extension) of the current path, if any.
- [FileOverwriteWarning](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.fileutility/fileoverwritewarning.md): When a warning is set, saving a file requires an additional mouse click. The warning is not serialised. Typically backup and autosave files will have this warning set to avoid them being summarily overwritten.
- [HasPath](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.fileutility/haspath.md): Gets a value indicating whether the file path has been set.
- [Path](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.fileutility/path.md): Gets the filepath that this document is associated with. Not every document is associated with a file, so this field may be null or empty. Assigning a new path to a file does not trigger a save action.
- [Thumbnail](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.fileutility/thumbnail.md): Gets or sets the thumbnail image for this document. The getter is lazy: if no thumbnail has been assigned yet it will attempt to generate one via [FileUtility.TryCreateThumbnail()](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.fileutility.md) on first access.

## Methods

- [AutoSave](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.fileutility/autosave.md): (2 overloads) Perform an autosave operation.
- [CreatePreview](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.fileutility/createpreview.md): Create a preview image of the entire document at a fixed scale. Unlike [FileUtility.TryCreateThumbnail()](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.fileutility.md), the result is not fit-to-bounds; the bitmap is sized to the document's [ObjectList.AttributeBounds](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.objectlist/attributebounds.md) multiplied by `scale`.
- [DeleteAutoSaveFile](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.fileutility/deleteautosavefile.md): Try and remove the autosave file.
- [PickNewSaveBackupFolder](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.fileutility/picknewsavebackupfolder.md): Ask the user to specify a new folder location for the [FileUtility.BackupUserFolder](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.fileutility/backupuserfolder.md). This method must be called on the UI thread.
- [SpecifyNewTimestampFormat](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.fileutility/specifynewtimestampformat.md): Display the UI needed to set a new backup timestamping format.
