Automatically Creating Project Folders
Automatically Creating Project Folders

Automatically Creating Project Folders

Hi! In this entry I'm going to show you a cool trick to set up a .bat file - which is an executable script in Windows- that will allow you to create new project folders on your PC for your projects.

What it does:

Essentially, we're creating a file that you can double click, and it will create an organized structure of folders that you've previously set up.

How is this different from having an empty template folder?

It's not too different -so if you're happy with that, I think that's the better way to go. However, there are some advantages to the script. For one, you won't need to have a default template folder structure lying around. Secondly, you can make this script prompt you for as many details from the project as you want, and it will automatically rename the folders based on that. You can ever set up some variables for folder naming!

That being said, let's get to it. You can start off by creating a .txt file. You can do this by either opening your notepad, or by right clicking inside folder and selecting > New > .txt file in the context menu. Once we're in the .txt file, we're going to write down a few lines. That's what our PC will read and act upon when executing the script. Firstly, the line

This line basically tells the script to work "in the background".

Secondly, we're going to give a name to the script, just so that when the windows for the prompt pop up, they have a name.

Thirdly, we're going to set up three variables. What this means is, we want our script to ask us, every time it's executed, for the name of our project, and the client. You can add as many variables as you want, and therefore customize every folder structure as much as you want. We're starting with two:

With these two new lines, the project will ask us for a "Client Name" and a "Project Name", and store those values in the variables project and client respectively.

And now for the actual folders. Here we're going to set up just one more variable to make our lives a little bit easier. This directory variable will essentially be the directory on which we want the folders to be created. For me, that's "A:\Dropbox\Honear\Work", but you can use any directory you want. We'll set it up like this

After this, we just have to ask the script to create the folders using our variables. Let's say we want something like: (Drop down)

From Client
Project Files

For almost each folder we want to create, we will have to write down a line of code. However, if we're creating the folder "Bin" inside "Assets", the "Assets" folder will also be created. So we can skip some. We start by typing "md" - a function that creates a new directory - and then our path, using the variables. The example for "Bin" is:

When the script goes through this line, it will replace those variables with your input. For me, this would result in

A:\Dropbox\Honear\Work\Client Name\Project Name\Assets\Bin

Now all that's left in this text file is to type down the rest of the folders you want to create. Your final text file would read something like this:

The final step is to save your file, and rename the extension so that it reads ".bat" instead of ".txt". Windows will ask you if you're really sure and you'll say yes. After that, try double clicking on the file and it should prompt you for your variables! If you need to edit the .bat file, you can right click on it, and then select "Edit" and it should open it again on your text editor.


That's all you need to get your automatic folder structure! However, we can push this further by adding a couple more lines, and playing around with a couple more complimentary tools to make this more powerful. I will be making a Part II where I show you how to include things like the current date into the folder name, as well as setting up several different variables to be able to pick different folders, or even different kinds of folder structures!