Just had a quick one this week I wanted to share. Since I make files for each working day of the year I wanted to automate this so I only had to do it once.
Making Directories using “os” (A Python Library).
This one is rather simple in that no added install is needed to get started. As long as you have base Python installed on your machine you are good to go.
This method will allow you to create directories that have any names you wish in any order you wish. I used it to make the names of directories.
Here is the code I used to accomplish this (it’s simpler than I thought it would be).
import os
root_path = '/Users/user/documents' #the root path goes here I am on a mac so it looks like so.
folders = ['file1','file2','file3',] #name folders
for folder in folders:
>>>os.mkdir(os.path.join(root_path,folder))
Feel free to copy this code and paste it into your own text editor to play around with it! 😀
To name the folders (technically directories) that you are making, simply replace the names of the ‘files’ with what you prefer. You can also create more directories than the number I have here. eg I used this code to make files named 1st 2nd 3rd and did this 12 times. Feel free to copy and paste this into your own text editors.
Looking forward to sharing more automations in the future! Be sure to stay tuned. The next one will be on punching in and out at work with a simple python script. Slowly turning the tasks of the day into automations one at a time. 🙂
Let me know if you have any questions!