Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > sci.electronics.design > #371959 > unrolled thread
| Started by | Don Y <this@is.not.me.com> |
|---|---|
| First post | 2015-08-07 00:38 -0700 |
| Last post | 2015-08-15 20:12 +0000 |
| Articles | 10 on this page of 30 — 13 participants |
Back to article view | Back to sci.electronics.design
OT: Sort directory *entries* Don Y <this@is.not.me.com> - 2015-08-07 00:38 -0700
Re: OT: Sort directory *entries* David Brown <david.brown@hesbynett.no> - 2015-08-07 10:06 +0200
Re: OT: Sort directory *entries* DecadentLinuxUserNumeroUno <DLU1@DecadentLinuxUser.org> - 2015-08-07 05:29 -0400
Re: OT: Sort directory *entries* Don Y <this@is.not.me.com> - 2015-08-07 09:44 -0700
Re: OT: Sort directory *entries* makolber@yahoo.com - 2015-08-07 10:36 -0700
Re: OT: Sort directory *entries* Don Y <this@is.not.me.com> - 2015-08-07 10:59 -0700
Re: OT: Sort directory *entries* makolber@yahoo.com - 2015-08-07 13:07 -0700
Re: OT: Sort directory *entries* Don Y <this@is.not.me.com> - 2015-08-07 13:43 -0700
Re: OT: Sort directory *entries* M Philbrook <jamie_ka1lpa@charter.net> - 2015-08-07 18:43 -0400
Re: OT: Sort directory *entries* David Brown <david.brown@hesbynett.no> - 2015-08-08 22:21 +0200
Re: OT: Sort directory *entries* upsidedown@downunder.com - 2015-08-09 00:36 +0300
Re: OT: Sort directory *entries* Don Y <this@is.not.me.com> - 2015-08-08 14:45 -0700
Re: OT: Sort directory *entries* jurb6006@gmail.com - 2015-08-15 20:36 -0700
Re: OT: Sort directory *entries* Robert Baer <robertbaer@localnet.com> - 2015-08-07 22:12 -0700
Re: OT: Sort directory *entries* Don Y <this@is.not.me.com> - 2015-08-07 22:39 -0700
Re: OT: Sort directory *entries* David Brown <david.brown@hesbynett.no> - 2015-08-09 13:10 +0200
Re: OT: Sort directory *entries* DecadentLinuxUserNumeroUno <DLU1@DecadentLinuxUser.org> - 2015-08-08 02:59 -0400
Re: OT: Sort directory *entries* whit3rd <whit3rd@gmail.com> - 2015-08-07 13:44 -0700
Re: OT: Sort directory *entries* Nobody <nobody@nowhere.invalid> - 2015-08-08 03:11 +0100
Re: OT: Sort directory *entries* Jasen Betts <jasen@xnet.co.nz> - 2015-08-08 03:55 +0000
Re: OT: Sort directory *entries* upsidedown@downunder.com - 2015-08-08 09:23 +0300
Re: OT: Sort directory *entries* Robert Baer <robertbaer@localnet.com> - 2015-08-07 22:11 -0700
Re: OT: Sort directory *entries* David Brown <david.brown@hesbynett.no> - 2015-08-08 22:28 +0200
Re: OT: Sort directory *entries* Don Y <this@is.not.me.com> - 2015-08-08 14:33 -0700
Re: OT: Sort directory *entries* Jasen Betts <jasen@xnet.co.nz> - 2015-08-09 04:15 +0000
Re: OT: Sort directory *entries* David Brown <david.brown@hesbynett.no> - 2015-08-09 13:21 +0200
Re: OT: Sort directory *entries* Robert Baer <robertbaer@localnet.com> - 2015-08-07 22:04 -0700
Re: OT: Sort directory *entries* DecadentLinuxUserNumeroUno <DLU1@DecadentLinuxUser.org> - 2015-08-08 02:58 -0400
Re: OT: Sort directory *entries* Dimitrij Klingbeil <nospam@no-address.com> - 2015-08-15 21:38 +0200
Re: OT: Sort directory *entries* Rob <nomail@example.com> - 2015-08-15 20:12 +0000
Page 2 of 2 — ← Prev page 1 [2]
| From | upsidedown@downunder.com |
|---|---|
| Date | 2015-08-08 09:23 +0300 |
| Message-ID | <7l7bsalu47mphp1clmfknb7geghrun5end@4ax.com> |
| In reply to | #372036 |
On 8 Aug 2015 03:55:57 GMT, Jasen Betts <jasen@xnet.co.nz> wrote: >On 2015-08-08, Nobody <nobody@nowhere.invalid> wrote: > >> If readdir() (or equivalent) always returns the filenames in a specific >> order, that's the "native" order, i.e. the order in which programs which >> traverse a directory will process the files. > >no order is specified in the readdir documentation. Try DIR /O-N The default is DIR /ON i.e. sort by name) and the "-" reverses that selection. Even on NTFS, the files are listed in more or less random order, _not_ sorted by name, extension, creation time, size as I can see. So that might be the "natural" order. To be certain, you would have to open the actual directory file in a hex editor and look for file names in UTF-16 (or is it UCS2), for Latin scripts, every other byte is null.
[toc] | [prev] | [next] | [standalone]
| From | Robert Baer <robertbaer@localnet.com> |
|---|---|
| Date | 2015-08-07 22:11 -0700 |
| Message-ID | <9cgxx.23581$g72.11027@fx12.iad> |
| In reply to | #371991 |
makolber@yahoo.com wrote: > >>> >>> For FAT (and FAT32), it's a different matter - files are kept in a flat >>> list in the directory structure, with an order than can easily be seen. >>> Some devices (such as many MP3 players) handle files in that order. >> >> Sorry, I should have mentioned FAT32. >> >>> There are probably utilities for Windows that can re-order the entries. >>> On Linux, there is "fatsort" which is often used for ordering files on >>> USB sticks for music players. >> > > So how to do "see" the native order of the files in the directory via Windows. > Mark If NTFS, you don't.
[toc] | [prev] | [next] | [standalone]
| From | David Brown <david.brown@hesbynett.no> |
|---|---|
| Date | 2015-08-08 22:28 +0200 |
| Message-ID | <mq5omb$77m$1@dont-email.me> |
| In reply to | #371982 |
On 07/08/15 18:44, Don Y wrote: > Hi David, > > On 8/7/2015 1:06 AM, David Brown wrote: >> On 07/08/15 09:38, Don Y wrote: >>> >>> Is there an established/built-in mechanism to reorder the dirent >>> structs on Windows filesystems? Or, is it cheaper for me just >>> to write a script to "coerce" things into the desired order? >> >> I take it you mean actually /change/ the order of the directory entries, >> rather than just make them look sorted. > > Yes. Edit the directory itself. > >> As far as I know, their is unlikely to be a way to do it for NTFS as the >> filesystem uses a B-Tree which does not track the order. So even if you >> individually copy files one-by-one into an NTFS directory, you will not >> get any particular order within the directory structures - adding a file >> could cause the B-Tree nodes to split with different divisions of the >> files. >> >> For FAT (and FAT32), it's a different matter - files are kept in a flat >> list in the directory structure, with an order than can easily be seen. >> Some devices (such as many MP3 players) handle files in that order. > > Sorry, I should have mentioned FAT32. > >> There are probably utilities for Windows that can re-order the entries. >> On Linux, there is "fatsort" which is often used for ordering files on >> USB sticks for music players. > > I just hacked together a quick shell script to sort the "names" based > on the criteria of interest, then moved them into a virgin directory. > Done. > > I was hoping there might have just been some magic incantation to do this > *for* me (e.g., Norton Utilities used to have this capability many aeons > ago). > Well, "apt-get install fatsort" then "fatsort" is almost exactly the magic you are looking for - except it is for Linux (and possibly *BSD). I expect these sorts of things are a lot easier on Linux than Windows - in particular, it's easy for a program on Linux to access an unmounted filesystems, while Windows insists on mounting filesystems which makes direct access much harder. On the other hand, Linux's caching layers make it harder to use a solution like the one you used. On Windows, the system treats the USB drive as completely dumb - and also treats the user as completely dumb. It assumes that you might pull the drive out at any moment, and therefore updates the directory and FAT continuously during a copy in order to keep these structures as current as possible. Therefore as long as you copy the files into the drive in the desired order, they will have that order in the directory structure. Linux caches metadata accesses, so the copies will be handled much faster (at least the metadata parts), but the ordering in the structures is less predictable unless your script does a "sync" between each copy.
[toc] | [prev] | [next] | [standalone]
| From | Don Y <this@is.not.me.com> |
|---|---|
| Date | 2015-08-08 14:33 -0700 |
| Message-ID | <mq5sjt$g3n$1@speranza.aioe.org> |
| In reply to | #372108 |
On 8/8/2015 1:28 PM, David Brown wrote: > On 07/08/15 18:44, Don Y wrote: >> Hi David, >> >> On 8/7/2015 1:06 AM, David Brown wrote: >>> On 07/08/15 09:38, Don Y wrote: >>>> >>>> Is there an established/built-in mechanism to reorder the dirent >>>> structs on Windows filesystems? Or, is it cheaper for me just >>>> to write a script to "coerce" things into the desired order? >>> >>> I take it you mean actually /change/ the order of the directory entries, >>> rather than just make them look sorted. >> >> Yes. Edit the directory itself. >> >>> As far as I know, their is unlikely to be a way to do it for NTFS as the >>> filesystem uses a B-Tree which does not track the order. So even if you >>> individually copy files one-by-one into an NTFS directory, you will not >>> get any particular order within the directory structures - adding a file >>> could cause the B-Tree nodes to split with different divisions of the >>> files. >>> >>> For FAT (and FAT32), it's a different matter - files are kept in a flat >>> list in the directory structure, with an order than can easily be seen. >>> Some devices (such as many MP3 players) handle files in that order. >> >> Sorry, I should have mentioned FAT32. >> >>> There are probably utilities for Windows that can re-order the entries. >>> On Linux, there is "fatsort" which is often used for ordering files on >>> USB sticks for music players. >> >> I just hacked together a quick shell script to sort the "names" based >> on the criteria of interest, then moved them into a virgin directory. >> Done. >> >> I was hoping there might have just been some magic incantation to do this >> *for* me (e.g., Norton Utilities used to have this capability many aeons >> ago). > > Well, "apt-get install fatsort" then "fatsort" is almost exactly the magic you > are looking for - except it is for Linux (and possibly *BSD). I expect these > sorts of things are a lot easier on Linux than Windows - in particular, it's > easy for a program on Linux to access an unmounted filesystems, while Windows > insists on mounting filesystems which makes direct access much harder. I'm going to assume the capabilities of "fatsort" are strictly "vanilla"; i.e., you can't force the order to be <whatever> but, rather, whatever the fatsort developer(s) decided were appropriate! For example, no way to ensure the proper location of IBMBIO.COM in old systems -- if other files having names of AAAA and ZZZZ also existed (?) > On the other hand, Linux's caching layers make it harder to use a solution like > the one you used. On Windows, the system treats the USB drive as completely > dumb - and also treats the user as completely dumb. It assumes that you might > pull the drive out at any moment, and therefore updates the directory and FAT > continuously during a copy in order to keep these structures as current as Sadly, that is not the case. Windows still uses deferred writes to update removable media. You can minimize your exposure to "self-foot-shooting" by using FATxx formatted filesystems on those media (it appears that Windows flushes these quicker than NTFS formatted removable media??) but there is still a window of vulnerability -- "must LOOK like we're being quick about it -- even when we aren't!" > possible. Therefore as long as you copy the files into the drive in the > desired order, they will have that order in the directory structure. Linux > caches metadata accesses, so the copies will be handled much faster (at least > the metadata parts), but the ordering in the structures is less predictable > unless your script does a "sync" between each copy. Actually, I think "sync; sync" is required as sync(2) can return before buffers are completely flushed (even double sync isn't "guaranteed" in light of soft updates -- unless you "tune the fish"! :> )
[toc] | [prev] | [next] | [standalone]
| From | Jasen Betts <jasen@xnet.co.nz> |
|---|---|
| Date | 2015-08-09 04:15 +0000 |
| Message-ID | <mq6k57$2np$2@gonzo.alcatraz> |
| In reply to | #372111 |
On 2015-08-08, Don Y <this@is.not.me.com> wrote: > On 8/8/2015 1:28 PM, David Brown wrote: >> Well, "apt-get install fatsort" then "fatsort" is almost exactly the magic you >> are looking for - except it is for Linux (and possibly *BSD). I expect these >> sorts of things are a lot easier on Linux than Windows - in particular, it's >> easy for a program on Linux to access an unmounted filesystems, while Windows >> insists on mounting filesystems which makes direct access much harder. > > I'm going to assume the capabilities of "fatsort" are strictly "vanilla"; > i.e., you can't force the order to be <whatever> but, rather, whatever > the fatsort developer(s) decided were appropriate! > > For example, no way to ensure the proper location of IBMBIO.COM in > old systems -- if other files having names of AAAA and ZZZZ also existed (?) yeah it seems fairly limited in capability, however you could specify "-I IBMBIO.COM" and hope that the empty string sorts first. probably better to patch it to ignore system files. -- \_(ツ)_
[toc] | [prev] | [next] | [standalone]
| From | David Brown <david.brown@hesbynett.no> |
|---|---|
| Date | 2015-08-09 13:21 +0200 |
| Message-ID | <mq7d10$i9r$1@dont-email.me> |
| In reply to | #372111 |
On 08/08/15 23:33, Don Y wrote: > On 8/8/2015 1:28 PM, David Brown wrote: >> On 07/08/15 18:44, Don Y wrote: >>> Hi David, >>> >>> On 8/7/2015 1:06 AM, David Brown wrote: >>>> On 07/08/15 09:38, Don Y wrote: >>>>> >>>>> Is there an established/built-in mechanism to reorder the dirent >>>>> structs on Windows filesystems? Or, is it cheaper for me just >>>>> to write a script to "coerce" things into the desired order? >>>> >>>> I take it you mean actually /change/ the order of the directory >>>> entries, >>>> rather than just make them look sorted. >>> >>> Yes. Edit the directory itself. >>> >>>> As far as I know, their is unlikely to be a way to do it for NTFS as >>>> the >>>> filesystem uses a B-Tree which does not track the order. So even if >>>> you >>>> individually copy files one-by-one into an NTFS directory, you will not >>>> get any particular order within the directory structures - adding a >>>> file >>>> could cause the B-Tree nodes to split with different divisions of the >>>> files. >>>> >>>> For FAT (and FAT32), it's a different matter - files are kept in a flat >>>> list in the directory structure, with an order than can easily be seen. >>>> Some devices (such as many MP3 players) handle files in that order. >>> >>> Sorry, I should have mentioned FAT32. >>> >>>> There are probably utilities for Windows that can re-order the entries. >>>> On Linux, there is "fatsort" which is often used for ordering files on >>>> USB sticks for music players. >>> >>> I just hacked together a quick shell script to sort the "names" based >>> on the criteria of interest, then moved them into a virgin directory. >>> Done. >>> >>> I was hoping there might have just been some magic incantation to do >>> this >>> *for* me (e.g., Norton Utilities used to have this capability many aeons >>> ago). >> >> Well, "apt-get install fatsort" then "fatsort" is almost exactly the >> magic you >> are looking for - except it is for Linux (and possibly *BSD). I >> expect these >> sorts of things are a lot easier on Linux than Windows - in >> particular, it's >> easy for a program on Linux to access an unmounted filesystems, while >> Windows >> insists on mounting filesystems which makes direct access much harder. > > I'm going to assume the capabilities of "fatsort" are strictly "vanilla"; > i.e., you can't force the order to be <whatever> but, rather, whatever > the fatsort developer(s) decided were appropriate! Why assume something, when it takes seconds to check? <http://www.unix.com/man-page/debian/1/fatsort/> There is no option for manually specifying the order, so you only get the orderings that the authors support, which is usually sufficient for the typical users. It is open source, and I don't imagine it is a big program - if you want to sort a lot of FAT directories in particular ways, then I expect it is a reasonable place to start for making your own specialised program. > > For example, no way to ensure the proper location of IBMBIO.COM in > old systems -- if other files having names of AAAA and ZZZZ also existed > (?) That appears to be correct - unless you can arrange to "cheat" using upper and lower case changes. I haven't used the program for anything other than sorting files for use on an MP3 player - the typical use-case for the program. > >> On the other hand, Linux's caching layers make it harder to use a >> solution like >> the one you used. On Windows, the system treats the USB drive as >> completely >> dumb - and also treats the user as completely dumb. It assumes that >> you might >> pull the drive out at any moment, and therefore updates the directory >> and FAT >> continuously during a copy in order to keep these structures as >> current as > > Sadly, that is not the case. Windows still uses deferred writes to update > removable media. You can minimize your exposure to "self-foot-shooting" > by using FATxx formatted filesystems on those media (it appears that > Windows flushes these quicker than NTFS formatted removable media??) > but there is still a window of vulnerability -- "must LOOK like we're > being quick about it -- even when we aren't!" It is impossible to avoid having a window of vulnerability (unless you made USB sticks with transaction processing on the stick, with corresponding costs). You are right that Windows treats NTFS removable media more like fixed media regarding caching - it is only FAT32 removable media that it is has fast flushing and syncing (since this extra flushing and syncing reduces the performance). > >> possible. Therefore as long as you copy the files into the drive in the >> desired order, they will have that order in the directory structure. >> Linux >> caches metadata accesses, so the copies will be handled much faster >> (at least >> the metadata parts), but the ordering in the structures is less >> predictable >> unless your script does a "sync" between each copy. > > Actually, I think "sync; sync" is required as sync(2) can return before > buffers are completely flushed (even double sync isn't "guaranteed" > in light of soft updates -- unless you "tune the fish"! :> ) >
[toc] | [prev] | [next] | [standalone]
| From | Robert Baer <robertbaer@localnet.com> |
|---|---|
| Date | 2015-08-07 22:04 -0700 |
| Message-ID | <t5gxx.25175$VN5.22152@fx14.iad> |
| In reply to | #371959 |
Don Y wrote: > Hi, > > Is there an established/built-in mechanism to reorder the dirent > structs on Windows filesystems? Or, is it cheaper for me just > to write a script to "coerce" things into the desired order? May i assume you are familiar with what is available (sort by name, by size, by type, by date)? What do you want for "order"?
[toc] | [prev] | [next] | [standalone]
| From | DecadentLinuxUserNumeroUno <DLU1@DecadentLinuxUser.org> |
|---|---|
| Date | 2015-08-08 02:58 -0400 |
| Message-ID | <v1absahq2toe0cvobr1n71dp4qvkggdjf6@4ax.com> |
| In reply to | #372042 |
On Fri, 07 Aug 2015 22:04:26 -0700, Robert Baer <robertbaer@localnet.com> Gave us: >Don Y wrote: >> Hi, >> >> Is there an established/built-in mechanism to reorder the dirent >> structs on Windows filesystems? Or, is it cheaper for me just >> to write a script to "coerce" things into the desired order? > May i assume you are familiar with what is available (sort by name, >by size, by type, by date)? > What do you want for "order"? He is not referring to a file browser's view settings, idiot. He is talking about physical placement of the files and directories on the volume itself. Your file browser does no such thing.
[toc] | [prev] | [next] | [standalone]
| From | Dimitrij Klingbeil <nospam@no-address.com> |
|---|---|
| Date | 2015-08-15 21:38 +0200 |
| Subject | Re: OT: Sort directory *entries* |
| Message-ID | <mqo4bv$2v8$1@dont-email.me> |
| In reply to | #371959 |
On 07.08.2015 09:38, Don Y wrote: > Hi, > > Is there an established/built-in mechanism to reorder the dirent > structs on Windows filesystems? Or, is it cheaper for me just to > write a script to "coerce" things into the desired order? Hi Don Sorry, but nope - at least not directly. But programs do exist that for you. Under Linux there's "fatsort" (that works on unmounted filesystems and images). Under Windows it gets more tricky because all volumes "visible" to the system are mounted by default, but there are programs that will unmount a volume, open it for exclusive access, then sort its directory structures and sync the changes. You can find one here: http://www.anerty.net/software/file/DriveSort/ At least that works on FAT filesystems. NTFS with its tree structure doesn't seem to be sortable in any meaningful way internally. Dimitrij
[toc] | [prev] | [next] | [standalone]
| From | Rob <nomail@example.com> |
|---|---|
| Date | 2015-08-15 20:12 +0000 |
| Message-ID | <slrnmsv794.if1.nomail@xs9.xs4all.nl> |
| In reply to | #371959 |
Don Y <this@is.not.me.com> wrote: > Hi, > > Is there an established/built-in mechanism to reorder the dirent > structs on Windows filesystems? Or, is it cheaper for me just > to write a script to "coerce" things into the desired order? You want to sort the entries on the disk itself? It is long ago that people did that... Or you want to read a directory and pass the entries to a handler in sorted order? That is more usual. Of course, how to do that depends on the programming or scripting language you are using.
[toc] | [prev] | [standalone]
Page 2 of 2 — ← Prev page 1 [2]
Back to top | Article view | sci.electronics.design
csiph-web