Editor functions, imported files

Hi,

I currently have an auto import program I am running that detects when an FBX and corresponding json description file are placed in a folder. It then performs an automated import with some custom changes I made to FbxFactory.cpp. The program then runs an ExecProcess to run the CookCommandlet for all the platforms we are supporting and performs a custom archive creation for each platform file that we store in the cloud for runtime download/instantiation.

This all works great, but when finished, I can’t seem to find a way to clear the uassets from the Content Browser. This is a problem because if I run the same asset and name the packages prior to saving to disk, I am getting an error …

Fatal error: [File:X:\Unreal Projects\UE4Engine\Engine\Source\Runtime\CoreUObject\Private\UObject\Obj.cpp] [Line: 98] 
Renaming an object (Package /Game/Cache/1893/Isa_HUD_v03__TEMP___Skeleton) on top of an existing object (Package /Game/Cache/1893/Skeleton) is not allowed

I have deleted all residue of the import process from the filesystem, all that remains are the assets in memory in the Content Browser, but I cannot find a way to remove them. We have tried:

FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked<FAssetRegistryModule>("AssetRegistry");

	UE_LOG(LogTemp, Warning, TEXT("Deleting assets"));

	//
	//  Get all assets in path
	//

	TArray<FAssetData> assetsInPath;
	TArray<UObject*> assetObjectsInPath;
	AssetRegistryModule.Get().GetAssetsByPath(*importAssetPath, assetsInPath, true);

	//
	//  Remove "assetsInPath"
	//

	for (int32 i = 0; i < assetsInPath.Num(); i++)
	{
		UObject *asset = assetsInPath[i].GetAsset();
		if (asset)
		{
			assetObjectsInPath.Add(asset);
			FString assetName = asset->GetName();
			UE_LOG(LogTemp, Warning, TEXT("..deleting asset %d ('%s')"), i, *assetName);
			AssetRegistryModule.Get().AssetDeleted(asset);
		}
		else
		{
			UE_LOG(LogTemp, Warning, TEXT("..no asset to delete"));
		}
	}

	ObjectTools::DeleteAssets(assetsInPath, false);
	ObjectTools::DeleteObjects(assetObjectsInPath, false);
	assetsInPath.Empty();
	assetObjectsInPath.Empty();
	//
	//  Remove "assets"
	//

	for (int32 i = 0; i < assets.Num(); i++)
	{
		UObject *asset = assets[i].GetAsset();
		if (asset)
		{
			assetObjectsInPath.Add(asset);
			FString assetName = asset->GetName();
			UE_LOG(LogTemp, Warning, TEXT("..deleting asset %d ('%s')"), i, *assetName);
			AssetRegistryModule.Get().AssetDeleted(asset);
		}
		else
		{
			UE_LOG(LogTemp, Warning, TEXT("..no asset to delete"));
		}

	}

	ObjectTools::DeleteAssets(assets, false);	
	ObjectTools::DeleteObjects(assetObjectsInPath, false);
	assets.Empty();
	assetObjectsInPath.Empty();

	UE_LOG(LogTemp, Warning, TEXT("Deleted assets"));

	// Remove any files saved in the cache folder	
	if (FPlatformFileManager::Get().GetPlatformFile().DirectoryExists(*cachePath))
	{
		if (FPlatformFileManager::Get().GetPlatformFile().DeleteDirectoryRecursively(*cachePath))
		{
			UE_LOG(LogTemp, Warning, TEXT("Deleted old cache directory: %s"), *cachePath);
		}
		else
		{
			UE_LOG(LogTemp, Warning, TEXT("Could not delete old cache directory: %s"), *cachePath);
		}
	}
	else
	{
		UE_LOG(LogTemp, Warning, TEXT("Could not find old cache directory: %s"), *cachePath);
	}

To no avail…Please, any help would be greatly appreciated.

Nevermind…

ObjectTools::ForceDeleteObjects(assetObjectsInPath, false);

was the answer.