# UEditorAssetLibrary::DoesDirectoryHaveAssets returns false even when folder has assets

**URL:** <https://forums.unrealengine.com/t/ueditorassetlibrary-doesdirectoryhaveassets-returns-false-even-when-folder-has-assets/2589279>\
**Category:** Plugins\
**Tags:** Code-Plugins, unreal-engine, question, CPP\
**Created:** [July 3, 2025, 3:55pm UTC](https://forums.unrealengine.com/t/ueditorassetlibrary-doesdirectoryhaveassets-returns-false-even-when-folder-has-assets/2589279 "2025-07-03T15:55:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![akie\_xx](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@akie\_xx](https://forums.unrealengine.com/u/akie_xx)\
**Post date:** [July 3, 2025, 3:55pm UTC](https://forums.unrealengine.com/t/ueditorassetlibrary-doesdirectoryhaveassets-returns-false-even-when-folder-has-assets/2589279/1 "2025-07-03T15:55:30Z")

</div>

Hi everyone,

I’m currently working on an Editor Utility module in Unreal Engine 5.5, and I’m trying to detect whether a specific content folder has assets in it.

I’m using the following API:

> ```auto
> UFUNCTION (BlueprintCallable, Category="Editor Scripting | Asset")  
> static bool DoesDirectoryHaveAssets  
> (  
> const FString & DirectoryPath,  
> bool bRecursive  
> )  
> 
> ```

However, even though the folder I’m checking (e.g. `/Game/MyFolder`) **does contain assets** , the function still returns `false`.

> ```auto
> void FSuperManagerModule::OnDeleteEmptyFolderButtonClicked() {
> FixUpRedirectors();
> TArray<FString> FolderPathArray = UEditorAssetLibrary::ListAssets(FolderPaths[0], true, true);
> uint32 Counter = 0;
> 
> FString EmptyFolderPathNames;
> TArray<FString> EmptyFolderPathArray;
> for (const FString& FolderPath : FolderPathArray) {
> if (FolderPath.Contains(TEXT("Developers")) ||
> FolderPath.Contains(TEXT("Collections")) ||
> FolderPath.Contains(TEXT(" __ExternalActors__")) ||
> FolderPath.Contains(TEXT(" __ExternalObjects__")) 
> ) continue;
> 
> if (!UEditorAssetLibrary::DoesDirectoryExist(FolderPath)) continue;
> //DebugHeader::Print(5.f, FColor::Green, FolderPath );
> if (!UEditorAssetLibrary::DoesDirectoryHaveAssets(FolderPath)) {
> 
> EmptyFolderPathNames.Append(FolderPath);
> EmptyFolderPathNames.Append("\n");
> 
> EmptyFolderPathArray.Add(FolderPath);
> }
> }
> 
> if (EmptyFolderPathArray.Num() == 0) {
> DebugHeader::ShowMessageDialog(EAppMsgType::Ok, TEXT("No empty folder found under select folder"), false);
> return;
> }
> 
> EAppReturnType::Type Result =
> DebugHeader::ShowMessageDialog(EAppMsgType::OkCancel, TEXT("Empty folder found in :\n") + EmptyFolderPathNames + TEXT("Would you like to delete them"), false);
> if (Result == EAppReturnType::Cancel) return;
> 
> for (const FString& EmptyFolder : EmptyFolderPathArray) {
> if (UEditorAssetLibrary::DeleteDirectory(EmptyFolder)) {
> ++Counter;
> }
> else {
> DebugHeader::PrintLog(TEXT("Failed delete ") + EmptyFolder);
> }
> }
> DebugHeader::ShowMessageDialog(EAppMsgType::Ok, TEXT("Successfully delete") + FString::FromInt(Counter) + TEXT(""), false);
> }
> 
> ```

Totally same as the course,but.

 ![图片](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/4/3/4433b12cf889ff6ac9b5d624916fc296cc408467.jpeg)  
 ![图片](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/d/5/7d5bc6b089aa5e755b04220501d94aa850e4467c.png)

As you can see, NewFolder/NewFolder1 is not Empty, however the ‘DoesDirectoryHaveAssets’ return false.

I want to know why and how to fix this.

---

<div class="post-metadata">

**Author:** ![easppl](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@easppl](https://forums.unrealengine.com/u/easppl)\
**Post date:** [August 6, 2025, 10:23am UTC](https://forums.unrealengine.com/t/ueditorassetlibrary-doesdirectoryhaveassets-returns-false-even-when-folder-has-assets/2589279/2 "2025-08-06T10:23:13Z")

</div>

I had the same problem.  
If you run on debug mode and trace the stack, you will see unreadable path string which passed to `return AssetRegistryModule.Get().HasAssets(*DirectoryPackageName, bRecursive);` Line1466,EditorAssetSubsystem.cpp;  
So I guess maybe somewhere doesn’t handle encoding correctly. You can try setting up “Global language support is available using Unicode UTF8” in Windows region settings and try again.Hope it helps!  
In Chinese:在Windows区域-管理-更改系统区域设置-Beta版：使用Unicode UTF-8提供全球语言支持-勾选-重启

---

<div class="post-metadata">

**Author:** ![Wilbert](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Wilbert](https://forums.unrealengine.com/u/Wilbert)\
**Post date:** [August 16, 2025, 8:16pm UTC](https://forums.unrealengine.com/t/ueditorassetlibrary-doesdirectoryhaveassets-returns-false-even-when-folder-has-assets/2589279/3 "2025-08-16T20:16:11Z")

</div>

I met the same problem too  
Interesting phenomenon, the function DoesDirectoryHaveAssets() is verifying the subfolder.  
Maybe path like this “/Game/Blueprint/NewFolder/” , the last / affects functionality

So, by removing the last /, it works  
Seems unreasonable

```auto
if (FolderPathName.EndsWith("/"))
{
	FolderPathName.RemoveAt(FolderPathName.Len() - 1);
}

if (!UEditorAssetLibrary::DoesDirectoryHaveAssets(FolderPathName))
{
	EmptyFolderPathsNames.Append(FolderPathName);
	EmptyFolderPathsNames.Append(TEXT("\n"));

	EmptyFoldersPathsArray.Add(FolderPathName);
}

```

---

<div class="post-metadata">

**Author:** ![guanter\_odimme](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@guanter\_odimme](https://forums.unrealengine.com/u/guanter_odimme)\
**Post date:** [January 14, 2026, 3:40am UTC](https://forums.unrealengine.com/t/ueditorassetlibrary-doesdirectoryhaveassets-returns-false-even-when-folder-has-assets/2589279/4 "2026-01-14T03:40:31Z")

</div>

true ,dude. I tested it in your way, and it works.
