Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sort Folder Collection 1

Status
Not open for further replies.

x75

Programmer
Mar 8, 2002
10
DE
Hi, I have a Folder Collection.
The name of the folders is the date they where created.
How can I sort the collection, so that the oldest folder is first and so on?

Or if that is not possible how can I get the name of the oldest folder?

Thanks for any reply
Johannes
 
Are we talking FSO? This is not a bug - it's an undocumented feature...
;-)
 
I don't think you can sort the contents of FSO, but you could insert the results in a db, or you might be able to do some magic with the dictionary object...
This is not a bug - it's an undocumented feature...
;-)
 
...or you could loop through your returns and use datediff to find the highest/lowest value... This is not a bug - it's an undocumented feature...
;-)
 
I know that I can not sort the contents of FSO. But I was hoping some one had a trick on how to do this.

I thought of putting them into a db, but I would prefer not to do that.

I found a code on how to do it in VB 6.
But I can't figure out how to create a new collection in Vb script.
Don't you think their is a way to at least get the oldest one?

Thanks
 
never mind just found a trick on how to do it!
 
Do share! This is not a bug - it's an undocumented feature...
;-)
 
I was going to,
but I had to code my Idea first. Here it is:

getoldestBackup = Date()
For each Folder in objRootFolder.SubFolders
If getoldestBackup < cdate(Folder.Name) then
getoldestBackup = cdate(Folder.Name)
End If
next

once it's done I'll have the date of the oldest Backup. That's all I needed. Because now I have a function that keeps calling itself and delets the oldes backup until only 5 are left.
 
Ok This is not a bug - it's an undocumented feature...
;-)
 
One little mistake!
must be
If getoldestBackup > cdate(Folder.Name) then
and not
If getoldestBackup < cdate(Folder.Name) then

thanks for your replies!
 
Oh,
I didn't saw your reply on &quot;..loop through your returns and use datediff..&quot;

Would be kind of the same thing!

Thanks again
 
Thx for all the stars! Much obliged ;) This is not a bug - it's an undocumented feature...
;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top