NSIS查找所有.txt文件 [英] NSIS Find all .txt files
本文介绍了NSIS查找所有.txt文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我目前正在检查在$INSTDIR中查找所有文本文件,如下所示。
但是,可能存在包含其他.txt文件的子目录,如$INSTDIRmySub。有没有办法既保持相似的循环结构,又搜索所有子目录?FindFirst $R0 $R1 "$INSTDIR*.txt"
IfErrors ExitInstaller 0
LoopIt:
Messagebox MB_OK "Do some processing on $R1"
FindNext $R0 $R1
IfErrors 0 LoopIt
推荐答案
Function ProcessTextFiles
Exch $0
Push $1
Push $2
FindFirst $1 $2 "$0*.txt"
loop:
IfErrors end
DetailPrint 'Found "$0$2"'
FindNext $1 $2
goto loop
end:
FindClose $1
FindFirst $1 $2 "$0*.*"
dirloop:
IfErrors dirend
IfFileExists "$0$2*.*" 0 dirnext
StrCmp $2 "." dirnext
StrCmp $2 ".." dirnext
Push "$0$2"
call ${__FUNCTION__}
dirnext:
FindNext $1 $2
goto dirloop
dirend:
FindClose $1
Pop $2
Pop $1
Pop $0
FunctionEnd
section
push "$InstDir"
call ProcessTextFiles
sectionend
这篇关于NSIS查找所有.txt文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文