Folder Management
Tools for organizing and maintaining clean folder structures in your Unreal Engine project.
Overview
Folder Management features:
- Delete empty folders recursively
- Clean up redirectors
- Fix broken folder structures
- Batch folder operations
- Blueprint-accessible folder utilities
Delete Empty Folders
Remove folders that no longer contain any assets.
What's Considered Empty?
A folder is empty if it contains:
- ❌ No .uasset files
- ❌ No subfolders with assets
- ✅ Only redirectors (optional)
- ✅ Only metadata files
Recursive Deletion
Starting from a base folder:
- Scan all subfolders recursively
- Identify empty folders
- Delete from deepest level upward
- Continue until no empty folders remain
Usage
From Content Browser:
Right-click folder → Elys Asset Tools → Delete Empty Folders
From Blueprint:
UERP_AssetToolsEditorSubsystem* Subsystem =
GEditor->GetEditorSubsystem<UERP_AssetToolsEditorSubsystem>();
Subsystem->DeleteEmptyFolders("/Game/Content");
From C++:
void UERP_AssetToolsEditorSubsystem::DeleteEmptyFolders(const FString& BasePath)
{
TArray<FString> EmptyFolders;
FindEmptyFoldersRecursive(BasePath, EmptyFolders);
for (const FString& FolderPath : EmptyFolders)
{
DeleteFolder(FolderPath);
}
}
Redirector Management
Redirectors are created when assets are moved or renamed. Over time, they can accumulate and should be cleaned up.
What Are Redirectors?
When you move an asset:
- UE creates a redirector at the old location
- The redirector points to the new location
- This ensures references aren't broken
But redirectors:
- Take up space
- Clutter the content browser
- Can cause confusion
- Should be cleaned up periodically
Clean Up Redirectors
After Move Operations:
// Automatically cleaned after moves
Subsystem->StartMoveAssets(Sources, Destination);
// Cleanup happens automatically
Manual Cleanup:
// Clean redirectors in a folder
Subsystem->FixRedirectorsInFolder("/Game/OldLocation");
UE Built-in Tool:
Right-click folder → Fix Up Redirectors in Folder
Detect Redirector-Only Folders
Find folders that contain only redirectors:
bool IsFolderOnlyRedirectors(const FString& FolderPath)
{
TArray<FAssetData> Assets;
AssetRegistry.GetAssetsByPath(*FolderPath, Assets, false);
for (const FAssetData& Asset : Assets)
{
if (Asset.AssetClassPath.GetAssetName() != "ObjectRedirector")
{
return false; // Found non-redirector
}
}
return Assets.Num() > 0; // Has redirectors only
}
Folder Operations
Check if Folder Exists
bool FolderExists(const FString& FolderPath)
{
IAssetRegistry& AssetRegistry = FModuleManager::LoadModuleChecked<FAssetRegistryModule>("AssetRegistry").Get();
TArray<FAssetData> Assets;
AssetRegistry.GetAssetsByPath(*FolderPath, Assets, false);
return Assets.Num() > 0;
}
Get All Assets in Folder
TArray<FAssetData> GetAssetsInFolder(const FString& FolderPath, bool bRecursive = false)
{
TArray<FAssetData> Assets;
IAssetRegistry& AssetRegistry = FModuleManager::LoadModuleChecked<FAssetRegistryModule>("AssetRegistry").Get();
AssetRegistry.GetAssetsByPath(*FolderPath, Assets, bRecursive);
return Assets;
}
Count Assets in Folder
int32 CountAssetsInFolder(const FString& FolderPath, bool bRecursive = true)
{
TArray<FAssetData> Assets = GetAssetsInFolder(FolderPath, bRecursive);
return Assets.Num();
}
Get Subfolders
TArray<FString> GetSubfolders(const FString& BasePath, bool bRecursive = false)
{
TArray<FString> SubPaths;
IAssetRegistry& AssetRegistry = FModuleManager::LoadModuleChecked<FAssetRegistryModule>("AssetRegistry").Get();
AssetRegistry.GetSubPaths(BasePath, SubPaths, bRecursive);
return SubPaths;
}
Planned Features
Flatten Folder Structure
Coming Soon: Flatten nested folders into a single level.
// Before: /Game/Root/Sub1/Sub2/Assets
// After: /Game/Root/Assets
Subsystem->FlattenFolder("/Game/Root", true);
Bulk Rename
Planned: Rename multiple folders at once.
// Rename pattern
TMap<FString, FString> Renames;
Renames.Add("/Game/Old1", "/Game/New1");
Renames.Add("/Game/Old2", "/Game/New2");
Subsystem->BulkRenameFolder(Renames);
Folder Documentation
Planned: Add README files to folders.
// Create folder README
Subsystem->CreateFolderREADME("/Game/MyFolder", "This folder contains character assets");
// Read folder README
FString ReadMe = Subsystem->GetFolderREADME("/Game/MyFolder");
Best Practices
Regular Cleanup
Clean up your project regularly:
- Weekly: Delete empty folders
- After big moves: Fix redirectors
- Before committing: Clean up the project
- Before releases: Remove unused content
Folder Organization
Maintain a clean structure:
- Use consistent naming conventions
- Group related assets together
- Avoid deeply nested folders (> 5 levels)
- Document folder purposes
Automation
Automate cleanup tasks:
// Editor utility widget for automated cleanup
void RunProjectCleanup()
{
UERP_AssetToolsEditorSubsystem* Subsystem =
GEditor->GetEditorSubsystem<UERP_AssetToolsEditorSubsystem>();
// 1. Delete empty folders
Subsystem->DeleteEmptyFolders("/Game");
// 2. Fix redirectors
Subsystem->FixRedirectorsInFolder("/Game");
// 3. Log results
UE_LOG(LogElysAssetTools, Log, TEXT("Project cleanup complete"));
}
API Reference
See Subsystem API for complete folder management API documentation.
Next Steps
- Safe Deletion - Safely remove folders
- Move Operations - Reorganize folder structures
- User Guide: Cleaning Up - Step-by-step cleanup guide