New folder for everyday with PowerShell. 

Question : How to create a folder for everyday of the year using PowerShell?

Answer: Everyday folders creation for an year can be achieved by many methods. One of the method mentioned here is by getting current date\year and uses for-each loop to create the new folder in specified target path.

$year = [datetime]::Now.Year    #Gets current year.Can replace $year=2019 or any year.
$inpath = “$env:USERPROFILE\my documents\$year\”     #Specify the path of creation
$count=0
1..12 | ForEach-Object {
$count++
$month=([cultureinfo]::InvariantCulture).DateTimeFormat.GetAbbreviatedMonthName($count)
New-Item -ItemType directory -name $month -Path $inpath -Force }

Folder for everyday of year

By AMARNATH K

AM@RNATH is a Technology specialist primarily focus on Microsoft Technologies & Cloud Security. His certification includes M365 Certified: Enterprise Admin Expert. He loves to explore things from the latest technologies to cooking new recipes. Basically from Chennai, the southern part of India. Lucky son, friendly husband, and a proud father who loves to spend time with his family & friends while the laptop is not in his table.

Leave a Reply

Your email address will not be published.