Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

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
1  
What does this have to do with gmail? – Ramhound Oct 9 '13 at 14:04
1  
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:

(get-date).AddDays(-1).ToString("yyyMMdd")

Found it on Technet

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .