To check if file or folder exists in Powershell you can use the following snippet.
Sample Powershell
for files use it like this
if(test-path "C:\Users\Codesnippets\Desktop\Test.xml")
{
echo "exists!"
}
else
{
echo "not exists!"
}
for folders/directories use it like this
if(test-path "C:\Users\Codesnippets\Desktop")
{
echo "exists!"
}
else
{
echo "not exists!"
}
RT @CodeSnippetsNET: How to check if file or folder exists in #Powershell http://t.co/QKVbxwmoKA #programming
RT @CodeSnippetsNET: How to check if file or folder exists in #Powershell http://t.co/QKVbxwmoKA #programming