I need an automatic way of making a lot of numbered folders

Create a .bat file inside the folder in which to create these sub-folders, and copy inside the following text:

@echo off
setlocal enableDelayedExpansion
FOR /l %%N in (1,1,94) do (
    set "NUM=00%%N"
    set "DIRNAME=ch.!NUM:~-3!"
    md !DIRNAME!
)

Double-click the .bat file and it will create the required chapters.

In the future, if you wish to create for example numbers 95 to 110, just change the FOR line to:

FOR /l %%N in (95,1,110) do (

Here's a PowerShell script:

for ($i=1; $i -lt 95; $i++) {
  $name = [string]::Format("ch.{0}", $i.ToString("000"));
  New-Item -Path "c:\source\temp" -Name $name -ItemType "directory"
}

Assuming you're on Windows, you can do Start > Run > "powershell.exe" > OK, then copy/paste this to the command line.

Note that you'll want to change c:\source\temp to the directory where you want the folders, and you can adjust the range to be created by adjusting the values in the for statement, where you see 1 and 95.


I believe there now is a Linux subsustem in Windows (I've never used it - in fact, I don't use Windows at all), so you could use a bash script - type it on the command line in a bash shell (is that the term in windows? - and note that '$' is the bash-prompt):

$ for i in $(seq -w 1 100)
> do
> mkdir ch.$i
> done

Personally I think it looks better than the powershell version - not least because you can split commands that take a block, over several lines.