Reputation: 414
I am trying to do the following:
src
dst
dst
, continue dst
, do somethingI'm struggling to understand how the nested IF statements should be structured
Upvotes: 1
Views: 26862
Reputation: 9991
Seems pretty straight given your requirements:
$src = "e:\temp"
$dst = "e:\temp2"
$filename = "test.txt"
# 1.Check for a file in src
if (Test-Path "$src\$filename")
{
# 1.A If that file is there copy it to dst
Copy-Item "$src\$filename" $dst
if (!(Test-Path "$dst\$filename"))
{
# 1.C If that file isn't in the dst do something
}
#1.B If that file exists in the dst continue
}
else
{
#2.Continue on but do something else
}
#3.Finish off and do something else
Upvotes: 5