473,626 Members | 3,369 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Sorting Files in Directory

I want to sort files in a specified folder by their creation date and then
display their names (sorted by the creation date) in a textbox for example.
How would you do that?

Dim dir As New DirectoryInfo(" C:\myFldr")
Dim myfile As FileInfo
For Each myfile In dir.GetFiles("* .*")
...
Next
Nov 21 '05 #1
1 1903
"Amjad" <Am***@discussi ons.microsoft.c om> schrieb:
I want to sort files in a specified folder by their creation date and then
display their names (sorted by the creation date) in a textbox for

example.

Get an array of 'FileInfo' objects and then sort them by create-date.
Maybe you'll have to write your own 'Comparer'.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
2086
by: Alan Searle | last post by:
I have been trying to get an array to sort on a particular column and have been having problems with my main key ... array_multisort($dirlist, SORT_DESC, SORT_STRING); This function takes an array ($dirlist) which has been loaded with a directory listing where each directory has its own index number ("dirid") and displays the listing in descending order by name ("dirname"). This works fine for the sorting of the names but the index...
6
10888
by: bissatch | last post by:
Hi, I am about to write an application that will display all pdf files in a folder and display them by file name in order of date. Is there an easy way of doing this? I was thinking about somehow adding filename and date created in an array, sorting by date and then printing onto an html page with a link to that file. How would I do this though? Is this the simplest method or is there a better way of doin this?
7
3255
by: Federico G. Babelis | last post by:
Hi All: I have this line of code, but the syntax check in VB.NET 2003 and also in VB.NET 2005 Beta 2 shows as unknown: Dim local4 As Byte Fixed(local4 = AddressOf dest(offset)) CType(local4, Short) = CType(src, Short)
4
1324
by: Niels | last post by:
Hello, I want to make a program that moves files from a main directory to a sub directory. Suggeset that i have 2000 files, the program will create 4 sub directory's and move 500 files to each directory. I think until this point it wont be a problem, but.... I want the files to be ordered by filesize. I mean that the first 500 files that will be moved will have the
25
2208
by: Dan Stromberg | last post by:
Hi folks. Python appears to have a good sort method, but when sorting array elements that are very large, and hence have very expensive compares, is there some sort of already-available sort function that will merge like elements into a chain, so that they won't have to be recompared as many times? Thanks!
3
1557
by: Eric Capps | last post by:
I am trying to open a directory on a file server to populate a drop down menu. I've been able to do this, but the results are not sorted alphabetically. How would I go about this? I've looked at the php.net site on directory functions, but haven't found a solution that works. The sort() function seemed like it should, but it instead returned an error: sort() expects parameter 1 to be array, resource given. Any help would be appreciated.
9
2050
by: Wolfgang Draxinger | last post by:
H folks, I got, hmm not really a problem, more a question of elegance: In a current project I have to read in some files in a given directory in chronological order, so that I can concatenate the contents in those files into a new one (it's XML and I have to concatenate some subelements, about 4 levels below the root element). It all works, but somehow I got the feeling, that my solution is not as elegant as it could be:
3
6522
by: pramodkh | last post by:
Hi All, I have a remote directory wherein some files will be generated. I am writting a PERL script in windows to get the latest file created in that directory.How do i achieve this? This is what i have tried so far... use FindBin; use strict; my $ScriptPath = $FindBin::Bin;
6
5683
by: Soren | last post by:
Hi, I'd like to read the filenames in a directory, but not the subdirectories, os.listdir() gives me everything... how do I separate the directory names from the filenames? Is there another way of doing this? Thanks!
3
3085
by: tevo | last post by:
Hello, I'm trying to do a Perl script on Windows (wish it was Unix) that goes to a directory, figures out which files are most recent, within the last week, then copies them to another dir. I'm stuck at the sorting of the files in a directory. This part of the code returns a list but it's not sorted by date: opendir(INPUTINFO, ".") or die "Doesn't work: $!"; my @xmlfiles = grep /\.xml$/, readdir INPUTINFO; my@sorted = map...
0
8196
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8705
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8637
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8364
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6125
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4092
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2625
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1808
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1511
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.