# Delete assets at runtime

**URL:** <https://forums.unrealengine.com/t/delete-assets-at-runtime/360887>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [June 15, 2016, 4:41pm UTC](https://forums.unrealengine.com/t/delete-assets-at-runtime/360887 "2016-06-15T16:41:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![axess21](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@axess21](https://forums.unrealengine.com/u/axess21)\
**Post date:** [June 15, 2016, 4:41pm UTC](https://forums.unrealengine.com/t/delete-assets-at-runtime/360887/1 "2016-06-15T16:41:22Z")

</div>

While using a butiful console command “record animation” I am creating new animation assets in desired folder. The question is - How can I delete this assets while playing?

I tried this code, but it doesn’t delete anything whatever name/path I’m trying to feed it:

```
#include "Time.h"
#include "MyBlueprintFunctionLibrary.h"
#include<stdio.h> 

bool UMyBlueprintFunctionLibrary::DeleteAsset(FString FileToDelete)
{
	if (remove("FileToDelete") != 0)
		return 0;
	else
		return 1;
}

```

Blueprint code runs on level start:

 ![94735-delete.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/c/8/6c84f3abeadf5ff057e8abd6cad38e0daa2a3039.png)

---

<div class="post-metadata">

**Author:** ![FSapio](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/fsapio/32/1194616_2.png) [@FSapio](https://forums.unrealengine.com/u/FSapio)\
**Post date:** [December 10, 2017, 12:47am UTC](https://forums.unrealengine.com/t/delete-assets-at-runtime/360887/2 "2017-12-10T00:47:13Z")

</div>

Well, just looking at your function, the code is not using the input _FString_, rather using just the same string “_FileToDelete_”.  
Maybe, you code should be

```
if (remove(FileToDelete) != 0)

```

As a result, the function remove() takes the _FString_ that is in input, rather than a hard coded string.

Let me know if this was your problem, or if you have any other question.
