Thanks very much for your answer. We can't use the first method, though it is a very good idea. The reason is that our application is DPF(Digital Photo Frame), a directory structure fixed is almost impossible. Users copy and delete photo(jpeg/bmp and so on) files to a DPF device by their own, so actually we can't control what the users do and the directory structure is not controllable at all.
> Why not impose a directory structure. eg my camera has a directory for > every 100 images. That would mean you only need a maximum of 100 > comparisons for the last file in the directory and for 10000 files you > need 100 directories. > Another option which would give a speed up is not to use numbers, but > a more dense naming scheme. eg fAA, fAB, fAC, ..., fAZ, fAa, ... fAz, > You still end up doing 10000 comparisons, but the strings you are > comparing are shorted so there is less work to do. > I assume you are using fatfs? Looking at fatfs_fo_dirread, this would > be easy to implement. You have the information you need in dentry. So > just add the new member d_type and fill it in. > Andrew -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss