So, I am studying an online course which has hundreds of sub lectures. I need to download the source code for each lecture in a corresponding sub-folder. With over 120 lectures, creating a sub-folder one by one is a painstaking process.
Here's my current folder structure:
Is there a way I can create all these sub-folders at once, along with the proper name, through a batch file or something similar.
Best Answer
How can I can create all these sub-folders at once, using my naming scheme?
To create the sub-folders (sub-directories) in a specific directory (that is not the current directory), you can do one of the following:
cd C:\Dropbox\Development
first ormd Lec-%%i
command tomd C:\Dropbox\Development\Lec-%%i
.Note:
mkdir
is a synonym formd
and can be used in its place.Below I show both alternatives, first from a
cmd
shell (command line), and second using a batch file.As a bonus (although not asked for in the original question) there is a
bash
shell alternative as well.From a
cmd
shell:or
From a batch file:
Or
Notes:
9
is the start number. Change if necessary.1
is the step. Do not change this.120
the end number. Change if necessary to the number of the last directory you require.To create files in another directory, you can either
cd C:\Dropbox\Development\Lec-%%i
first ormd
command tomd C:\Dropbox\Development\Lec-%%i
.Is there a way to do a similar thing for Mac OSX from the Mac terminal?
From a
bash
shell:Or (for a more portable version)
Further Reading