Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Scripting

Posted on 2014-01-07
3
Medium Priority
?
192 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 2000 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

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

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

Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
Having trouble getting your hands on Dynamics 365 Field Service or Project Service trial? Worry No More!!!
This tutorial will show how to configure a single USB drive with a separate folder for each day of the week. This will allow each of the backups to be kept separate preventing the previous day’s backup from being overwritten. The USB drive must be s…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

721 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