![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | Creating a dated directory I'm a scripting and PowerShell newbie. I have a daily requirement to create a directory with yesterday's date. I wrote a function to calculate yesterday's date and put it in the variable, $yesterday. I can't figure out how to extract the date as a string and insert it in the new-item cmdlet to create the directory. Does anyone have any suggestions? -- Terry Edwards |
| | #2 (permalink) | ||||||||||||
| Guest | Re: Creating a dated directory Hello Terry, Something like this will work: $date = ( get-date ).AddDays(-1).ToString('yyyyMMdd') mkdir "c:\$date"
| ||||||||||||
| | #3 (permalink) | ||||||||||||||||||||||||
| Guest | Re: Creating a dated directory Thanks, Karl. It worked. How do you find out about the ".AddDays" and ".ToString" functions? -- Terry Edwards "Karl Mitschke" wrote:
| ||||||||||||||||||||||||
| | #4 (permalink) | ||||||||||||||||||||||||||||||||||||
| Guest | Re: Creating a dated directory Hello Terry, $date = ( get-date ) $date |gm ![]()
| ||||||||||||||||||||||||||||||||||||
| |
| |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| creating or pasting a directory in Windows Explorer | Mitch | Vista installation & setup | 0 | 01-11-2008 09:15 AM |
| Creating a list of files that have been deleted from or added to a directory | hrh1818 | PowerShell | 5 | 10-11-2007 09:43 PM |
| creating files in the system directory | Jeff McKay | Vista file management | 3 | 04-03-2007 06:32 PM |
| re: creating files in the system directory | Jeff McKay | Vista file management | 0 | 03-03-2007 12:39 PM |
| Posts dated in the future? | Jack K | Vista General | 2 | 06-16-2006 02:48 PM |