[Solved] Renaming a folder with huge amount of assets in it

I got asked recently about how to practically rename a project’s root folder that had a huge amount of assets in it which a large team had been working on for a long time. To the point of it being unfeasible to rename in the Editor.

It’s possible but a bit of work, my practical recommendation would be to just keep the folder name, it won’t show up to end users playing the game anyway.

If you don’t want to keep the folder name and it’s too many assets to practically rename inside the Editor, you CAN do it but it does require re-saving all assets in your project.

  • First make sure Unreal Editor is fully shut down.
  • In Windows Explorer (not inside of Unreal Editor), rename your folder.
  • Create a package wildcard redirector from the old folder name to the new one so Unreal knows how to resolve the references to the new folder path. Open YourProject/Config/DefaultEngine.ini and add to it:

[CoreRedirects]
+PackageRedirects=(OldName=“/Prototyping/…”, NewName=“/NewFancyName/”, MatchWildcard=true)

  • Since wildcard redirectors are slow and should only be used temporarily we’ll now make all assets have the new references saved into them. Run the ResavePackages commandlet, you can do it like this: C:\Path\To\Your\Engine\Binaries\Win64\UnrealEditor-Cmd.exe "C:\Path\to\YourProject.uproject" -run=ResavePackages -ProjectOnly -IgnoreChangelist. For large projects this can take a very long time.
  • Now delete the redirector section from your DefaultEngine.ini file.
  • Check references to assets in your config files. Game modes, startup maps and such use paths which you’ll need to fix manually.
  • Save games and local config files can contain old references, delete them from everyone’s /Saved folder to prevent crashes.
  • Open Unreal Editor and make sure it all worked. Open assets in the new folder, enter PIE, try packaging the project and running it. Keep an eye on the log for any missing references.
  • When happy, reconcile your project to check the resaved assets back into version control. This will be a lot of files (all of them basically) and will take a lot of time for large projects. No one else can be working on those assets also so the entire team is stopped while you’re doing this unless you make the commandlet skip checked-in assets via -SkipCheckedOutPackages.

The ResavePackages commandlet has a bunch of parameters you might want to look into, for example having it check the files into version control for you, skip checked-out assets, only resaving assets in certain folders, etc. Check out UResavePackagesCommandlet::Main in UnrealEd\Private\Commandlets\ContentCommandlets.cpp for the parameters it accepts.

There’s also this community resource on the ResavePackages commandlet for reference.

After typing this all out, I want to again mention that you can just keep the folder name as is :sweat_smile:

1 Like