Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need a Powershell script which helps me to create a folder on destination with one previous date.

Currently, I am using the code below. It helps me to create a folder on destination place with current date but I need folder with previous date.

$destination = "C:\abc"

Testing if the path Exist or not

md $destination -ErrorAction:SilentlyContinue 

Create a Test folder in destination path (name will be same as Zip file)

$folder = $destination + "\" + (get-date -Format yyyyMMdd) + "." 
$folderName = (get-date -Format yyyyMMdd) + "." md $folder
share|improve this question
What does this have to do with gmail? – Ramhound Oct 9 '13 at 14:04
I'm a little confused. You just want to make a folder with the date in it's name? – EBGreen Oct 9 '13 at 14:30
…or have its timestamp be before the current date? – Synetech Oct 9 '13 at 16:00
up vote 0 down vote accepted

This line seems to do the trick:


Found it on Technet

share|improve this answer
PERFECT !! Thanks – Ankit Oct 9 '13 at 19:27

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.