i was wondering how to list just the directory's in a certain directory. i think that it uses the findnextfile and findfile functions but im not really sure. any help would be appriciated. thanks
Posted on 2000-11-19 02:56:00 by warren
Hello warren, it seems as if this apis are not very well liked cause I have had a similar question and I just got some small reply. I have a source for listing directories and files in a TXT File but it is far from complete. I have uploaded it to my private homepage server. You can find it here. http://home.t-online.de/home/krause.stefan/ Please wait atleast half an our after my post, so that T-online can update all servers with my files. Hope this code helps you somehow. NOTE1: It is not commented! NOTE2: Part of it is done by Mashh! Thanks Mashh!! So long Happy coding Stefan
Posted on 2000-11-19 04:50:00 by Stefan Krause
Hello warren, just tried to access the server and it is already up. Go and get it! So long Happy coding Stefan
Posted on 2000-11-19 04:57:00 by Stefan Krause
To find all the directorys in a parent directory, you do use FindFirstFile ,FindNextFile, except use a search string of "*". The as each file is found test is attributes for FILE_ATTRIBUTE_DIRECTORY . (Note the parent directory is defined by the currect directory. See help on SetCurrentDirectory or you could use the search string "c:\dir1\dir2\*")
Posted on 2000-11-19 16:21:00 by George
I'd like to look at this code. I tried your site but I cannot find the file to download. Is it still online?
Posted on 2001-01-02 17:09:00 by Frank Hale
I've got this piece of code that does something similar of what you asked for.. it's used to write on a socket(remoteDescriptor), but you can easily change it.. param1 is the directory you want to to look into(es c:\test\*.*) .data? hsearch dd ? infos WIN32_FIND_DATA infos2 WIN32_FIND_DATA .data sep db 13, 10,0 ; carriage, linefeed, zero dirsep db ' ', 13, 10, 0 .code invoke lstrlen, ADDR param1 invoke szMid, ADDR param1, ADDR zero, 1, eax invoke FindFirstFile, ADDR zero, ADDR infos mov hsearch, eax .if infos.dwFileAttributes==FILE_ATTRIBUTE_DIRECTORY invoke lstrcat, ADDR infos.cFileName, ADDR dirsep invoke lstrlen, ADDR infos.cFileName INVOKE send, remoteDescriptor, ADDR infos.cFileName , eax, 0 .else invoke lstrcat, ADDR infos.cFileName, ADDR sep invoke lstrlen, ADDR infos.cFileName INVOKE send, remoteDescriptor, ADDR infos.cFileName , eax, 0 .endif INVOKE FindNextFile, hsearch, ADDR infos2 ciclo: .if infos2.dwFileAttributes==FILE_ATTRIBUTE_DIRECTORY invoke lstrcat, ADDR infos2.cFileName, ADDR dirsep invoke lstrlen, ADDR infos2.cFileName INVOKE send, remoteDescriptor, ADDR infos2.cFileName , eax, 0 .else invoke lstrcat, ADDR infos2.cFileName, ADDR sep invoke lstrlen, ADDR infos2.cFileName INVOKE send, remoteDescriptor, ADDR infos2.cFileName , eax, 0 .endif mov infos2.cFileName, "," INVOKE FindNextFile, hsearch, ADDR infos2 cmp eax, 0 jne ciclo invoke FindClose, hsearch
Posted on 2001-01-02 17:55:00 by *mi*
I use this method, but this code doesn't see 'Mes Documents' (french os) and 'Program Files' as directory... any idea (s)
Posted on 2001-01-03 05:30:00 by (scalp)