Use AutoHotKey to create a daily folder

I spend a fair bit of my time checking the results of automated jobs over the course of a few days for different clients. As a result I frequently ended up creating temporary folders for several days in a row and naming them with the current date. After a few weeks the penny dropped and I decided to automate the process a little.

Now I could have added a little scheduled task to create a folder each day, but honestly I don’t need to use it every day and I don’t really want to litter my hard drive with empty folders … though I guess I could also write something to clean those up. But why create it if you don’t need it?

I opted instead to write a little AutoHotKey script to create the folder if it doesn’t exist and then open it in explorer. So by assigning the script to a hot key combination (Windows + T was my preference) I can then create and open the folder or just open it if it already exists.

It’s pretty straight forward in how it works and the script is commented

  • just make sure you set the strTempDir variable to be the directory in which you want to create your daily directory. In the script below I’m creating it in c:\temp.
;Set the directory in which you want to create your new day's directory
strTempDir = c:\temp
;Create a directory path based on today's date stamp in the directory specified above
strTempPath = %strTempDir%\%A_YYYY%-%A_MM%-%A_DD%
;Create the directories in the path (will do nothing if they exist already)
FileCreateDir, %strTempPath%
;Open an explorer window at the directory
Run, explorer /e`,%strTempPath%,, UseErrorLevel
Author: Stephen Millard
Tags: | autohotkey |

Buy me a coffeeBuy me a coffee

Related posts that you may also like to read