Verify Whether or Not a Directory Exists Using Windows PowerShell

Uses Windows PowerShell to verify that a folder exists.

 
 
 
 
 
(0)
Add to favorites
Storage
8/10/2009
E-mail Twitter del.icio.us Digg Facebook
Sign in to ask a question


  • 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 \\server.org.ca\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.
      Thanks,
      Lance
    • 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.
      Cheers.