Best way to create folders using custom file path?

Hey everyone!

I’m currently looking for a way to run folder creation while circumventing the config’s settings/root when it comes to file paths.

For example, say the user of my app is on a config where the roots.yml points toward a volume named \\A. For this app only, I want the root to be \\B. I don’t want to move them off of the config that they’re currently on—I only want to create and register folders in a different location in this particular instance, while otherwise matching the schema.

Any ideas on how to do this cleanly?


Hi Jess

Welcome to the forums, thanks for posting here!

I would say that this scenario sounds like you would want multiple roots. Is this something you have considered already?

Also is this a custom app?

If it is a custom app, and you wanted to restrict the creation of the folders in the second root to only be created when your app ran, you could set a defered_creation setting on the second root’s project folder. Something like:

defered_creation: ["custom-app-name"]

Then in your app you could run the folder creation, something like

tk.create_filesystem_structure(entity_type, entity_id, engine="custom-app-name")

If your app also needs to create files within that root, you could have template paths setup to use the root as well, and configure your app to use them.

Note: I’ve not actually tried setting a defered_creation flag at a project folder level before, so I’m not certain if that will work.