Verify Whether or Not a Directory Exists Using Windows PowerShell

Uses Windows PowerShell to verify that a folder exists.

Add to favorites
E-mail Twitter Digg Facebook
  • How to modify to use a PSDrive?
    2 Posts | Last post April 29, 2011
    • Can this script be used to check for the existence of a directory in a mapped network drive?  Specifically, I have tried to create a 
      new-PSDrive J FileSystem \\\folder1\folder2
      then use J in the IO.Directory::Exists() statement, but it fails miserably.
      However, if I have mapped J: outside of powershell, it works fine.
      The server share is a Netware share.
    • The joys of being a newbie to scripting in general, after trying to make this work for longer than I care to admit, I found the powershell cndlet Test-Path.