Scripting

Hi Guys

Does anyone have an idea of how to work out if a folder is at the "end" of a folder structure?

Ie. it doesn't have any more folders in it?

Thanks
rory
WhitservicesAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
pony10usConnect With a Mentor Commented:
The following should work as long as you don't have any files WITHOUT extensions.

(get-childitem -filter "*.").count
if ($_count -ne $null) {
	Echo " Not last folder"
}
Else
{
	Echo "Last folder"
}

Open in new window

0
 
Chris HInfrastructure ManagerCommented:
Dir *.
returns directory list.

standard last line is X Dir(s)  XXXXXXXXXX bytes free.

If you ran dir *. and checked the last line, 1st token against the value equal to 2, it should be at the end of the structure.  Assuming there are no hidden or system directories.
0
 
WhitservicesAuthor Commented:
Fantastic, thanks very much.
0
All Courses

From novice to tech pro — start learning today.