Delete folder/file ingame? [SOLVED]

Is possible to delete a file (texture) or folder ingame?
My project is for mobile, I need to take some screenshots and putting them inside a folder inside the Content folder, but I see it increases the User Data in the App Info on Android and these screenshots are not deleted with no use but are increasing memory. There is any way to delete them?
I’m using the command bugscreenshot UE5.3.2

If C++ is fine for you, you have FFileManagerGeneric and IPlatformFile to do such operation as copy/delete/move files and folders.

FString FolderToDeletePath = "path to delete";

//1st way using IPlatformFile:
IPlatformFile& FileManager = FPlatformFileManager::Get().GetPlatformFile();

if (!&FileManager)
{
	return;
}

bool success = FileManager.DeleteDirectory(*FolderToDeletePath);


//2nd way using FFileManagerGeneric (there are some more options here)
bool success = FFileManagerGeneric::Get().DeleteDirectory(*FolderToDeletePath , true, true);

IPlatformFile: IPlatformFile::DeleteDirectory | Unreal Engine 5.4 Documentation | Epic Developer Community
FileManagerGeneric: FFileManagerGeneric::DeleteDirectory | Unreal Engine 5.3 Documentation | Epic Developer Community

1 Like

Finally got it working on Android/Mobile :fire:
If anyone needs it in the future just go ahead and enable this amazing UE Plugin
“Blueprint File Utilities” it will also work on Android

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.