Tenalinaga's Blog

I am frog in a well. Every time I jump out of the well; I relialize I am in bigger well and eventually get bored which motivates me to get to next level.

BizTalk Scripting Samples for Build Automation

We keep adding as I work on them.. [:)].

Create Folder Locations using Power Shell Script

When dealing with a large project that has multiple receive location and send locations creating them is time consuming and error prone if you forget to create any. Scripting this task is simple and easy to replicate.

$TableNames =
“TestSubProject1″,”TestSubProject2”

$Path = “D:\Test\ProjectFileLocation\”
$PathBTpickup = “\BTInLocation”
$PathTestData = “\BTSampleData”
$PathBTOut = “\BTOutLocation”

foreach ($folder in $TableNames)
{
$Temp = $Path + $folder

if( Test-Path $Temp)
{
write-host $Temp “FolderExist”
}
else
{
New-Item $Temp -type directory
write-host $Temp “FolderCreated”
}

}

foreach ($folder in $TableNames)
{
$Temp = $Path + $folder + $PathBTpickup

if( Test-Path $Temp)
{
write-host $Temp “FolderExist”
}
else
{
New-Item $Temp -type directory
write-host $Temp “FolderCreated”
}
}

foreach ($folder in $TableNames)
{
$Temp = $Path + $folder + $PathBTOut

if( Test-Path $Temp)
{
write-host $Temp “FolderExist”
}
else
{
New-Item $Temp -type directory
write-host $Temp “FolderCreated”
}
}

foreach ($folder in $TableNames)
{
$Temp = $Path + $folder + $PathTestData

if( Test-Path $Temp)
{
write-host $Temp “FolderExist”
}
else
{
New-Item $Temp -type directory
write-host $Temp “FolderCreated”
}
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: