Automate File Structure
As I’ve stated in my first Tutorial in Premiere Pro, the importance of a consistent folder structure is essential to keep your sanity in the long run. A specific path and a detailed naming can help you work faster now, back up your stuff regularly with ease and find the file you were working on much faster. Many programs like Lightroom or Capture One give you the option to create specific folders and subfolders when importing the files, but we’ll learn to do it for whatever file we want and customize it to our needs.
I am not a programmer
You are not a programmer you are a photographer, a motion 3D artist or a video editor so why get in the trouble to learn to program? That’s what I was telling myself when I was thinking to dive into programming and I was wrong. When I’ve tried to learn in the past I was making the same mistake over and over again. I was reading too much theory and tried to do simple exercises that were focused on syntax and not on a real-world problem. So I came across a book called Automate the Boring Stuff with Python, and the title alone was the inspiration I needed.
I studied little theory, and then I’ve tried to make a small script for something that I would use in my daily routine
What it does
In a few words, the script asks what kind of project am I working on and then it prompts me to enter a name for the Project. After that, it fetches the current date and it combines with the name I gave and creates a folder. Inside that folder creates the subfolders that are appropriate depending on the project. You can use the same script and customize it to your needs and you can also build on top of that.
I will try to explain it as simple as possible, but without going into theory analysis, just keep in mind for those who are beginners that you must keep the syntax as it is because for a missing quote the whole program can stop working, so be careful when you make your own changes.
How it works
We will start with line 14. When you start the program it asks you what function you want to choose. You can erase and change the yellow text inside the quotes, to your needs. The text inside these quotes is called a string. Write something that makes sense to you.
IMPORTANT! The numbers here don’t play a role here. It’s just there to remind what value I have assigned to each function. You will understand better reading the next block.
How to customize the code
Going up to line 7, we see our functions and the values assigned to them. The words on the left are variables, and you can name it as you want. Their naming here doesn’t appear anywhere when you use the script. You can also change the values on the right inside the quotes. You can use numbers, letters or even whole words.
Dissecting the Code
In this part of our script line 17, starts the real interesting part. In the first line, the application evaluates our input earlier. If you’ve pressed 1 earlier then it will run the commands that are inside the if statement. So it will print How do you want to name your photo Folder? As before you can change the text inside the quotes.
When the script waits for your input, in reality, is in line 20 waiting for you to assign a value to a variable, which is called nameFolder.
In the first line after our input, line 22 we set the path for our folder. We choose that using a method called chdir (change the current directory to a specific path). Inside the Parenthesis you will change the path where you want your folder to get placed.
In the line after that, we use another method called mkdir (make directory) to create a folder. The name of the folder starts with today at the beginning which fetches the current date, then a space inside the quotes, and then the name of the folder we gave earlier.
Once it does that we tell it to change directory again and go inside that folder we’ve created and made 3 new folders, Captures, Selected, Exports.
That was the script, it’s incomplete of course and I am just a beginner at this but I thought it would be useful to gather all the information I’ve found in one place and share it with you. Hope it will help you start your own adventure in the fascinating world of programming. There are great sources out there to learn, but the biggest inspiration for me was Automate the Boring Stuff because it gave me the idea to turn what I’ve learned into tools that I use daily.
If this helped you, subscribe to my YouTube Channel for more