tags:

views:

41

answers:

2

I am in the process of writing a script to make changes to folder permissions. Before it does that I would to do some checking to make sure that I am working in the correct directory. My problem is how do I check to see if four subfolders (i.e. Admin, Workspace, Com, & Data) exists before the script progresses. I assume I would be using Test-Path on each directory.

+3  A: 

What's wrong with the following?

if ( (Test-Path $path1) -and (Test-Path $path2) ) { 

}
JaredPar
A: 

Hint:

Remember to specify -LiteralPath - stops any possible misinterpretation. I've "been there" (so to speak) with this one, spending hours debugging code.

Simon Catlin