Quantcast
Channel: Rob V IT
Viewing all articles
Browse latest Browse all 64

Automatic way of making a lot of folders

$
0
0

There are multiple reasons why you need a lot of pre-created folders. Making the folders by hand would be a very boring time intensive job. So make use of the available script languages in your system. I have written some examples below.

Create multiple folders with PowerShell

$prefix = "TST"
$basepath = "c:\Temp"
1..100 | % {new-item -Type Directory -name $($Prefix.$_) -path $basepath }

#Or with formatting the numbers to 3 decimals.
1..100 | % {new-item -Type Directory -name $([string]::Format("$Prefix.{0}", $_.ToString("000"))) -path $basepath }

Create multiple folders with CMD

for /l %i in (0,1,999) do md %i

Create multiple folders on Unix

mkdir TST.{000..099}

The post Automatic way of making a lot of folders appeared first on Rob V IT.


Viewing all articles
Browse latest Browse all 64

Trending Articles