Red Gate forums :: View topic - Create directory if it doesn't exist
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation

Deployment Manager PowerShell Scripts forum

Create directory if it doesn't exist

Search in Deployment Manager PowerShell Scripts forum
Post new topic   Reply to topic
Jump to:  
Author Message
jtucker@inflexxion.com



Joined: 27 Jun 2013
Posts: 12
Location: Boston

PostPosted: Mon Jan 13, 2014 1:59 pm    Post subject: Create directory if it doesn't exist Reply with quote

Code:
function CreateDirIfItDoesNotExist
{
param([string]$folder)
   "Entering Powershell Library: CreateDirIfItDoesNotExist: Test for existence of " + $folder | Write-host
   if (Test-Path $folder)
   {
      $folder + " already exists, not disturbing it!" | Write-host
   }
   {
      $folder + " does not exist, creating it" | Write-host
      New-Item $folder -type directory -Force
   }
}
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group