Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Find most recent subfolders

Reply
 
Old 05-15-2009   #1 (permalink)
JJ


 
 

Find most recent subfolders

I have a folder containing some number of subfolders with names
derived from dates, each of them created on that date:

yyyy-mm-dd

For example:

/myfolder/
.../2009-04-18/
.../2009-04-25/
.../2009-05-02/
.../2009-05-09/

I want to find the most recent two folders. When I step through the
myfolder.Subfolders collection, they're always in the correct name
order, but I suspect that this is not guaranteed. I there any way to
be certain that they'll be in order? Can I sort the Subfolders
collection, or is my only option to copy the names to an array, then
implement an array sort?

My System SpecsSystem Spec
Old 05-15-2009   #2 (permalink)
Pegasus [MVP]


 
 

Re: Find most recent subfolders


"JJ" <jim.mcatee@xxxxxx> wrote in message
news:16260050-b01a-4ce7-84ad-ee29b635dd55@xxxxxx
Quote:

>I have a folder containing some number of subfolders with names
> derived from dates, each of them created on that date:
>
> yyyy-mm-dd
>
> For example:
>
> /myfolder/
> ../2009-04-18/
> ../2009-04-25/
> ../2009-05-02/
> ../2009-05-09/
>
> I want to find the most recent two folders. When I step through the
> myfolder.Subfolders collection, they're always in the correct name
> order, but I suspect that this is not guaranteed. I there any way to
> be certain that they'll be in order? Can I sort the Subfolders
> collection, or is my only option to copy the names to an array, then
> implement an array sort?
Here are a couple of methods:
- Read the folders into an array, then sort the array by folder date;
- Use the Exec method to invoke the command
cmd /c "dir /b /ad /od "c:\My Folder""
then pick up the console output.


My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
WLM Subfolders? Live Mail
Missing subfolders Vista mail
recent upgrade XP professionals 32 bit to Vista 64bit cant find dr Vista networking & sharing
Sharing all subfolders Vista networking & sharing
where did my subfolders go? Vista mail


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46