Quote:
|
Originally Posted by jazz
Hi,
Yes the program looks at all the files in the directory.
There is a directory, which has "n" number of directories and each sub-directory has files.
For example there is directory X, which has sub directories like 2924 and 3024(like the ones in red); and each subdirectory has files like 0108602924, 0108302924, 0108292924; and this file have the format of Layer code, SubCode, BrandCode and so on(part highlighted in green).
The below is the extract of a dump.
The attachment i posted in earlier message is also a dump of the files which jave to be sorted.
Jazz
|
I've picked up on this thread very late, but I'm wondering if it wouldn't be practical to just simplify this whole "directory X, which has sub directories like 0180602924, which each have a number of files...", business.
You could code this thing to death, but how simply wonderfully elegant it would be to make one *.bat file to handle all this?
Not only would the whole program become trivial to write, and far smaller, but it would also sort by the keys you need, if they were placed in the proper order:
Primary sortkey, secondary sortkey, tertiary sortkey, etc.
The file sorting would very probably be 5 times faster, because Windows reserves special resources just for sorting - and it's BLAZINGLY fast. Neither the standard C libray nor my own fav version of Quicksort, stood a chance in hell of beating it.
If you're looking for good performance from Quicksort, you should NOT try and feed it subsorted data! You want the data you feed it to be as unsorted as is feasable. Remember, Quicksort has an abominable worst case performance on already sorted data. Subsets that are sorted should also be avoided.
Adak