Solved

Scripting

Posted on 2014-01-07
3
186 Views
Last Modified: 2014-01-07
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
0
Comment
Question by:Whitservices
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 16

Expert Comment

by:choward16980
ID: 39762586
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
 
LVL 26

Accepted Solution

by:
pony10us earned 500 total points
ID: 39762947
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
 

Author Closing Comment

by:Whitservices
ID: 39763666
Fantastic, thanks very much.
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As with any other System Center product, the installation for the Authoring Tool can be quite a pain sometimes. This article serves to help you avoid making these mistakes and hopefully save you a ton of time on troubleshooting :)  Step 1: Make sur…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question