How to restrict who may read my blog?
Enumerate files in date order
Hello Guest
  
  • Login
• Register…
• Start blog
  • Who, Where, When
• What is interesting here?
• Duels
  • Polls
• Avatars
• Interests
  • Cities and Countries
• Random blog
• Users search
  • Search
• Games
• Tests
• QAIX
  • Сообщества
• Talxy Chat
• Horoscope
• Online
 
Register!

QAIX > Web-hosting, dedicated, colocation > Enumerate files in date order 27 November 2008 00:23:59

  Top users: 
  Recent blog posts: 
  Forums:   
  Discuss: 
  Recent forum topics: 
  Recent forum comments:
  Модератор:

Enumerate files in date order

Chris Miller 26 November 2008 22:35:32
 Hi Folks,

The following snippet will let me enumerate files...

var fs = new ActiveXObject("Scri­pting.FileSystemObje­ct");
var f = new Enumerator(fs.GetFo­lder(d).files);

for ( ; !f.atEnd(); f.moveNext())
{
:
}

How do I assert the order I want the files? Alphabetical by Name, Date of
Creation, Date of Last Access, you get the idea...

Thanks,

Chris.


Add comment
Anthony Jones 27 November 2008 00:23:59 permanent link ]
 "Chris Miller" <Chris(a)InfoGreat.­com> wrote in message
news:O4Gmr4$TJHA.58­4@TK2MSFTNGP06.phx.g­bl...
Hi Folks,
The following snippet will let me enumerate files...
var fs = new ActiveXObject("Scri­pting.FileSystemObje­ct");
var f = new Enumerator(fs.GetFo­lder(d).files);
for ( ; !f.atEnd(); f.moveNext())
{
:
}
How do I assert the order I want the files? Alphabetical by Name, Date of
Creation, Date of Last Access, you get the idea...

You can't control the order the files are retrieved from the Files
collection (on an NTFS volume they will be in alphanumerical name order),
you need first dump them into an array then sort the array.

var fs = new ActiveXObject("Scri­pting.FileSystemObje­ct");
var f = new Enumerator(fs.GetFo­lder(d).files);
var files = [];

for ( ; !f.atEnd(); f.moveNext())
files.push(f.item()­)

function propertyComparator(­property)
{
return function(o1, o2)
{
return o1[property] < o2[property] ? -1 : (o1[property] ==
o2[property] ? 0 : 1)
}
}

files.sort(property­Comparator('DateLast­Modified'))

//now files is sorted in order of DateLastModified


--
Anthony Jones - MVP ASP/ASP.NET

Add comment
 

Add new comment

As:
Login:  Password:  
 
 
  
 
Пожалуйста, относитесь к собеседникам уважительно, не используйте нецензурные слова, не злоупотребляйте заглавными буквами, не публикуйте рекламу и объявления о купле/продаже, а также материалы нарушающие сетевой этикет или законы РФ. Ваш ip-адрес записывается.


QAIX > Web-hosting, dedicated, colocation > Enumerate files in date order 27 November 2008 00:23:59

see also:
reports question
Realisation ...
Pulling field value for remote webpage
pass tests:
What is Your Temperament?
see also:
How to Put DVD/Video on iPod, PSP…
Full Reviews: iPod to iPod, iPod to…
How to convert Tod files/Mod files?

  Copyright © 2001—2010 QAIX
Идея: Монашёв Михаил.
Авторами текстов, изображений и видео, размещённых на этой странице, являются пользователи сайта.
See Help and FAQ in the community support.qaix.com.
Write in the community about the bugs you have noticedbugs.qaix.com.
Write your offers and comments in the communities suggest.qaix.com.
Information for parents.
Пишите нам на .
If you would like to report an abuse of our service, such as a spam message, please .
Если Вы хотите пожаловаться на содержимое этой страницы, пожалуйста .