Get & Rename Folders Using Scripting API

Hi! I’d like to rename every folder in my project using the scripting API to standardize naming conventions. I’ve figured out how to do this with events using studio.project.model.Event.findInstances(); - however, the same idea does not work for folders, eg. studio.project.model.Folder.findInstances();

How should I format this query? What concept am I missing?

Thanks!

Hi,

On most objects in Studio, you can use the function .dump() which will print their variables and functions in the console. But the main thing to look at for a folder is the entity type, while having a folder selected in Studio:

studio.window.browserCurrent().dump()
(ManagedObject:EventFolder):
id: "{db8b822f-18fa-4a3e-9e18-b425fd8ae064}",
entity: "EventFolder",
isValid: true,
relationships: (ManagedRelationshipMap:EventFolder),
properties: (ManagedPropertyMap:EventFolder),
isOfType: <function>,
isOfExactType: <function>,
note: undefined,
color: "Default",
name: "1",
folder: (ManagedObject:MasterEventFolder),
items: [],
getItem: <function>,
dump: <function>,
document: <function>,

Here you can see that folders are actually EventFolders. So in your function, you will want to change it to

studio.project.model.EventFolder.findInstances();

The Folder entity actually refers to folders in the Asset tab as they are folders that exist in the asset directory rather than just in FMOD Studio.

Hope this helps!

Thanks Connor, this was really helpful.

1 Like