In VB.NET (Visual Basic) I would like to list the files in a Windows folder in the physical order that they were stored on the disc. I have some mp3 players that do not sort the songs in alphabetic order, but just play them in the order that they were stored in the disc. Example:
I copy the files to a folder in this order and the mp3 player plays them in the same order:
04 Song 4
07 Song 7
01 Song 1
06 Song 6
02 Song 2
I am not talking about a Visual Basic program playing the songs. My Juke Box program works fine. I am talking about a little radio/mp3 player, and the infotainment system in one of my cars. I would like to use Visual Basic to show me the order they will be played in, to tell me if I need to re-store all of them or if the folder will play correctly. If I use a DOS command prompt and a DIR command, it shows them in their physical order. I want to be able to do that with Visual Basic.
I do not want to run a DOS command. It would be nice to get the file names and directory info into the program.
Googling has provided me with no help.
I have looked at the parameters on the FileIO.FileSystem.GetFiles(...) command and see nothing of any help.
Ok, for a simple example, you can pull files from a folder like this:
Now, in above I used *.png, but you could of course use *.mp3
So, I created a form with a listbox, and the result is now this:
And the order is the same as the files in the folder
Say this:
And if you wish, you can show the full file name with this code:
And the result is now this:
And since we using "FileInfo", then the size of the file is also available.
Say this:
And we now have this:
So, there is no sorting or changing order of the files in that folder, and as above shows, files are returned in the order they have in that folder.