Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

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

Your Answer

 
discard

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.