How to check if URL is a file or directory
You can use Microsoft's PowerShell to determine if a given URL is a directory or file. To start PowerShell, click on Start -> find and type in "PowerShell" ( without the quotes ). Windows PowerShell will show up. Right click on Windows PowerShell and click on Run as Administrator, this will bring up Windows PowerShell.
We will use the following PowerShell command :
Get-Item will load the file or directory object
System.IO.DirectoryInfo to determine if it is a directory or not.
Will return TRUE if it is a directory or FALSE if not.
First we load the URL to an object and then check the object's properties:
$item = Get-Item SOME_URL
$isDir = $item -is [System.IO.DirectoryInfo]
$isDir
The above code will return TRUE if the URL given is a directory