Archive: How to use FindFirst, FindNext ?


How to use FindFirst, FindNext ?
Does anybody know how to use FindFirst and FindNext instructions ?

If I use this:
FindFirst ${Handle} ${FileName} *.*
it returns all files and directories including "." and ".."

1) What can be used as "filespec" ? Documentation is very brief.
2) How do I distinguish files from directories ?
3) Can I get only files or files+directories without "." and ".." ?
4) How can I search for file in certain directory and its subdirectiories ? (can FindFirst and FindNext be used for this purpose?). This would be very usefull - at least for me :-)


filespec should be a full path with wildcard. example:

FindFirst $0 $1 "$WINDIR\*.*"
StrCmp $0 "" fail
loop:
StrCmp $1 "" done
StrCmp $1 "." skip ; $1 is the relative path, does not include $WINDIR
StrCmp $1 ".." skip
IfFileExists $WINDIR\$1\*.* skip ; is directory, skip
DetailPrint "Found File: $1"
FindNext $0 $1
done:
FindClose $0
fail: