Directory Sort

Just starting out? Need help? Post your questions and find answers here.
bcgreen
User
User
Posts: 33
Joined: Sun Nov 02, 2003 7:33 am
Location: Pullman, WA

Directory Sort

Post by bcgreen »

Question: Is there a way to change how files in a directory are sorted in PB? I want to be able to list directories as they are listed in windows explorer...For instance: How can I produce a directory listing that looks like this:

Code: Select all

pic1
pic2
...
...
pic9
pic10
Rather than this:

Code: Select all

pic1
pic10
pic2
...
...
pic8
pic9
As always, thanks in advance!!!
Bryan
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

you could sort them first on length and then subsort them alphabetically, but that would mean that picx comes before pic10, and i'm not sure that is what you want :-)
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
Froggerprogger
Enthusiast
Enthusiast
Posts: 423
Joined: Fri Apr 25, 2003 5:22 pm
Contact:

Post by Froggerprogger »

use pic01 ... pic09 or if you have more than 99 pics use pic001 ... pic009 :)
%1>>1+1*1/1-1!1|1&1<<$1=1
GPI
PureBasic Expert
PureBasic Expert
Posts: 1394
Joined: Fri Apr 25, 2003 6:41 pm

Post by GPI »

NOTE:
Windows sort the direectory only on NTFS-Systems. When the user have a FAT32-System you MUST sort it manual!

FAT32 isn't dead, because it is the only File-Format that all OS can read and write (Linux,Windows,...)

So always sort your directory-entries manuall!
Post Reply