create folder in powershell with previous date

0

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

Ankit

Posted 2013-10-09T14:01:20.677

Reputation: 13

1What does this have to do with gmail? – Ramhound – 2013-10-09T14:04:04.290

1I'm a little confused. You just want to make a folder with the date in it's name? – EBGreen – 2013-10-09T14:30:41.020

…or have its timestamp be before the current date? – Synetech – 2013-10-09T16:00:02.603

Answers

0

This line seems to do the trick:

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

Found it on Technet

EliadTech

Posted 2013-10-09T14:01:20.677

Reputation: 2 076