Powershell script to create folders

Hi All,

Is there any way to create a folder with yesterday's date using powershell. My requirement is that everyday the script should run to create a folder with yesterday's date automatically. Also this folder will have 6 sub folders with different subfolders as given below

D:\scripts\yesterdays date\server1

Any idea
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bhupesh SingalAutomation AnalystCommented:
Purpose: Create a Directory with PowerShell.  

[IO.Directory]::CreateDirectory("D:\scripts\yesterdays date\server1")

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
VJ1980Author Commented:
HI ,

I need the yesterdays date should be fetched automatically by the script & then to create a folder with the name 27-12-2010. Any idea
You could try the code below, and set it up as an automatic daily job.  Again -- no powershell to test with on this laptop so i can't guarantee this will work.
md "folder_$((get-date).AddDays(-1).toString('yyyyMMdd'))"

Open in new window

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming Languages-Other

From novice to tech pro — start learning today.