Recently, I needed to generate a large number of empty text files for a project and looked for the best way to automate this.
I’m certain there are numerous ways to accomplish this, but I found a quick Windows command line method of doing so.
First, create a text file that has the filename and extension for the files. In my case, I needed to make a file for each day of a specific year in the past, so I created a files.txt file that looked something like this:
2008-01-01.md
2008-01-02.md
2008-01-03.md
I saved that in a folder on my laptop’s C: drive, then navigated to that folder from the Windows command line.
From there, the following command will read the files.txt file and create a new file for each line in that directory:
for /f "delims=" %F in (files.txt) do copy nul "%F"
From there, I was able to move the files to the application directory where I needed them and begin processing them.