File System Library
File, folder, drive, and async file-operation nodes for Windows Native Toolkit.
Use this library for safe Windows file-system operations. Async operations utilize Unreal's built-in background thread pool (AnyBackgroundThreadNormalTask). Destructive actions validate empty paths, drive roots, Windows system folders, invalid names, and source or destination mistakes before the operation runs.
Async File Operations
Move File To Path, Move Folder To Path, Copy File To Path, Copy Folder To Path, Delete File, Delete Folder, Recycle File, Recycle Folder, Rename File, and Rename Folder are async action nodes. In Blueprint they give an immediate Then continuation pin plus direct On Success and On Fail exec pins.
Failure Reporting
Public error-message pins were removed. When a node fails, it uses the On Fail pin for Blueprint flow and writes the detailed reason with UE_LOG(Error, ...).
Move File To Path
Moves one file into a destination folder on a background thread.
| Pin | Direction | Purpose |
|---|---|---|
WorldContextObject | Input | Context used to register the async action with the game instance. |
File | Input | Full path to the source file. |
DestinationFolder | Input | Target folder path. |
bOverwrite | Input | Allows the destination file to be replaced when it already exists. |
Then | Output | Continues immediately after the async action is created. |
On Success | Output | Fires when the move completes successfully. |
On Fail | Output | Fires when validation or the move operation fails. |
#include "FileSystemLibrary.h"
UFUNCTION()
void HandleFileOperationSuccess();
UFUNCTION()
void HandleFileOperationFail();
UAsyncFileSystemOperation* Operation =
UAsyncFileSystemOperation::MoveFileToFolder(this, SourcePath, DestinationFolder, true);
Operation->OnSuccess.AddDynamic(this, &UMyObject::HandleFileOperationSuccess);
Operation->OnFail.AddDynamic(this, &UMyObject::HandleFileOperationFail);Move Folder To Path
Moves one folder into another folder on a background thread.
| Pin | Direction | Purpose |
|---|---|---|
WorldContextObject | Input | Async action registration context. |
File | Input | Full path to the source folder. |
DestinationFolder | Input | Target parent folder path. |
bOverwrite | Input | Allows overwriting an existing target folder. |
Then | Output | Continues immediately after the node starts. |
On Success | Output | Fires when the move succeeds. |
On Fail | Output | Fires when validation or the move fails. |
#include "FileSystemLibrary.h"
void AMyActor::ExampleUsage()
{
UAsyncFileSystemOperation* Operation =
UAsyncFileSystemOperation::MoveFolderToFolder(this, SourceFolder, DestinationFolder, false);
}Copy File To Path
Copies one file into a destination folder on a background thread.
| Pin | Direction | Purpose |
|---|---|---|
WorldContextObject | Input | Async action registration context. |
File | Input | Full path to the source file. |
DestinationFolder | Input | Target folder path. |
bOverwrite | Input | Allows replacing an existing destination file. |
Then | Output | Continues immediately after the node starts. |
On Success | Output | Fires when the copy succeeds. |
On Fail | Output | Fires when validation or the copy fails. |
#include "FileSystemLibrary.h"
void AMyActor::ExampleUsage()
{
UAsyncFileSystemOperation* Operation =
UAsyncFileSystemOperation::CopyFileToFolder(this, SourcePath, DestinationFolder, true);
}Copy Folder To Path
Copies one folder tree into a destination folder on a background thread.
| Pin | Direction | Purpose |
|---|---|---|
WorldContextObject | Input | Async action registration context. |
File | Input | Full path to the source folder. |
DestinationFolder | Input | Target parent folder path. |
bOverwrite | Input | Allows replacing an existing destination folder. |
Then | Output | Continues immediately after the node starts. |
On Success | Output | Fires when the copy succeeds. |
On Fail | Output | Fires when validation or the copy fails. |
#include "FileSystemLibrary.h"
void AMyActor::ExampleUsage()
{
UAsyncFileSystemOperation* Operation =
UAsyncFileSystemOperation::CopyFolderToFolder(this, SourceFolder, DestinationFolder, true);
}Delete File
Permanently deletes one file on a background thread after path safety checks.
| Pin | Direction | Purpose |
|---|---|---|
WorldContextObject | Input | Async action registration context. |
Folder | Input | Full path to the file to delete. |
Then | Output | Continues immediately after the node starts. |
On Success | Output | Fires when the file is deleted. |
On Fail | Output | Fires when validation or deletion fails. |
#include "FileSystemLibrary.h"
void AMyActor::ExampleUsage()
{
UAsyncFileSystemOperation* Operation =
UAsyncFileSystemOperation::DeleteFileW(this, FilePath);
}Delete Folder
Permanently deletes one folder tree on a background thread after path safety checks.
| Pin | Direction | Purpose |
|---|---|---|
WorldContextObject | Input | Async action registration context. |
Folder | Input | Full path to the folder to delete. |
Then | Output | Continues immediately after the node starts. |
On Success | Output | Fires when the folder is deleted. |
On Fail | Output | Fires when validation or deletion fails. |
#include "FileSystemLibrary.h"
void AMyActor::ExampleUsage()
{
UAsyncFileSystemOperation* Operation =
UAsyncFileSystemOperation::DeleteFolder(this, FolderPath);
}Recycle File
Moves one file to the Windows Recycle Bin instead of deleting it permanently.
| Pin | Direction | Purpose |
|---|---|---|
WorldContextObject | Input | Async action registration context. |
FilePath | Input | Full path to the file to recycle. |
Then | Output | Continues immediately after the node starts. |
On Success | Output | Fires when Windows accepts the recycle request. |
On Fail | Output | Fires when validation or the recycle request fails. |
#include "FileSystemLibrary.h"
void AMyActor::ExampleUsage()
{
UAsyncFileSystemOperation* Operation =
UAsyncFileSystemOperation::RecycleFile(this, FilePath);
}Recycle Folder
Moves one folder to the Windows Recycle Bin instead of deleting it permanently.
| Pin | Direction | Purpose |
|---|---|---|
WorldContextObject | Input | Async action registration context. |
FolderPath | Input | Full path to the folder to recycle. |
Then | Output | Continues immediately after the node starts. |
On Success | Output | Fires when Windows accepts the recycle request. |
On Fail | Output | Fires when validation or the recycle request fails. |
#include "FileSystemLibrary.h"
void AMyActor::ExampleUsage()
{
UAsyncFileSystemOperation* Operation =
UAsyncFileSystemOperation::RecycleFolder(this, FolderPath);
}Rename File
Renames a file in place on a background thread.
| Pin | Direction | Purpose |
|---|---|---|
WorldContextObject | Input | Async action registration context. |
FilePath | Input | Full path to the existing file. |
NewFileName | Input | New file name. Include the extension when the file should keep one. |
bOverwrite | Input | Allows replacing an existing file with the same target name. |
Then | Output | Continues immediately after the node starts. |
On Success | Output | Fires when the rename succeeds. |
On Fail | Output | Fires when validation or the rename fails. |
#include "FileSystemLibrary.h"
void AMyActor::ExampleUsage()
{
UAsyncFileSystemOperation* Operation =
UAsyncFileSystemOperation::RenameFile(this, FilePath, TEXT("Renamed.txt"), true);
}Rename Folder
Renames a folder in place on a background thread.
| Pin | Direction | Purpose |
|---|---|---|
WorldContextObject | Input | Async action registration context. |
FolderPath | Input | Full path to the existing folder. |
NewFolderName | Input | New folder name only, not a full path. |
bOverwrite | Input | Allows replacing an existing folder with the same target name. |
Then | Output | Continues immediately after the node starts. |
On Success | Output | Fires when the rename succeeds. |
On Fail | Output | Fires when validation or the rename fails. |
#include "FileSystemLibrary.h"
void AMyActor::ExampleUsage()
{
UAsyncFileSystemOperation* Operation =
UAsyncFileSystemOperation::RenameFolder(this, FolderPath, TEXT("RenamedFolder"), true);
}Get File Info
Returns metadata for one file path.
| Pin | Direction | Purpose |
|---|---|---|
FilePath | Input | File path to inspect. |
Return Value | Output | FWNTFileInfo containing file-specific metadata. |
#include "FileSystemLibrary.h"
void AMyActor::ExampleUsage()
{
const FWNTFileInfo Info = UFileSystemLibrary::GetFileInfo(FilePath);
}FWNTFileInfo Fields
| Field | Description |
|---|---|
bExists | True if the file exists on the disk. |
FileSize | Size of the file in bytes. |
CreationTime | The date and time the file was created. |
LastAccessTime | The date and time the file was last accessed. |
LastWriteTime | The date and time the file was last modified. |
bIsReadOnly | True if the file has the read-only attribute set. |
bIsHidden | True if the file is hidden by the OS. |
Get Folder Info
Returns metadata for one folder path.
| Pin | Direction | Purpose |
|---|---|---|
FolderPath | Input | Folder path to inspect. |
Return Value | Output | FWNTFolderInfo containing folder-specific metadata. |
#include "FileSystemLibrary.h"
void AMyActor::ExampleUsage()
{
const FWNTFolderInfo Info = UFileSystemLibrary::GetFolderInfo(FolderPath);
}FWNTFolderInfo Fields
| Field | Description |
|---|---|
bExists | True if the directory exists on the disk. |
CreationTime | The date and time the folder was created. |
LastAccessTime | The date and time the folder was last accessed. |
LastWriteTime | The date and time the folder was last modified. |
bIsHidden | True if the directory is hidden by the OS. |
The folder struct intentionally does not include size. Use Get Folder Size for size queries.
Get Folder Size
Calculates folder size asynchronously. This node is highly optimized using FDirectoryStatVisitor for O(1) syscall performance on large directories.
Calculates folder size asynchronously. This node is highly optimized using FDirectoryStatVisitor for O(1) syscall performance on large directories.
Calculates folder size asynchronously and can report progress while the scan runs.
| Pin | Direction | Purpose |
|---|---|---|
WorldContextObject | Input | Async action registration context. |
FolderPath | Input | Folder path to scan recursively. |
Then | Output | Continues immediately after the node starts. |
On Progress | Output | Reports the current accumulated size in bytes while scanning. |
On Success | Output | Reports the final folder size in bytes. |
On Fail | Output | Fires when validation fails, the scan fails, or the scan is canceled. |
#include "FileSystemLibrary.h"
UFUNCTION()
void HandleFolderSizeProgress(int64 FolderSizeBytes);
UFUNCTION()
void HandleFolderSizeSuccess(int64 FolderSizeBytes);
UFUNCTION()
void HandleFolderSizeFail(int64 FolderSizeBytes);
UAsyncGetFolderSize* Operation = UAsyncGetFolderSize::GetFolderSize(this, FolderPath);
Operation->OnProgress.AddDynamic(this, &UMyObject::HandleFolderSizeProgress);
Operation->OnSuccess.AddDynamic(this, &UMyObject::HandleFolderSizeSuccess);
Operation->OnFail.AddDynamic(this, &UMyObject::HandleFolderSizeFail);Show File In Explorer
Opens Windows Explorer and selects the specified file or folder.
| Pin | Direction | Purpose |
|---|---|---|
FilePath | Input | File or folder path to reveal in Explorer. |
#include "FileSystemLibrary.h"
void AMyActor::ExampleUsage()
{
UFileSystemLibrary::ShowFileInExplorer(FilePath);
}Get Drives
Returns available Windows drives and basic capacity information.
| Pin | Direction | Purpose |
|---|---|---|
Return Value | Output | TArray<FPartitionInfo> with drive identity and capacity details. |
#include "FileSystemLibrary.h"
void AMyActor::ExampleUsage()
{
const TArray<FPartitionInfo> Drives = UFileSystemLibrary::GetAllAvailablePartitions();
}FPartitionInfo Fields
| Field | Description |
|---|---|
DriveLetter | The drive letter assigned to the partition (e.g., "C"). |
VolumeName | The human-readable label of the volume. |
FileSystem | The format of the file system (e.g., "NTFS", "FAT32"). |
TotalSpaceMB | The total storage capacity of the partition in Megabytes. |
FreeSpaceMB | The available free storage on the partition in Megabytes. |
DriveType | The type of drive (e.g., Fixed, Removable, Network). |
Last updated on