本帖最后由 卩s丶孩孓灬 于 2025-1-17 13:49 编辑
配置文件
[File]
Number1=❤.png
Number2=1233.jpeg
Number3=_.jpeg
Number4=國画.jpeg
代码#include <Array.au3>
; 读取INI文件
$ini_file = "config.ini"
; 读取所有的section
$sections = IniReadSectionNames($ini_file)
For $i = 1 To $sections[0]
; 读取指定section下的所有key和value
$keys = IniReadSection($ini_file, $sections[$i])
For $j = 1 To $keys[0][0]
Global $g_sDirPath = @ScriptDir
Global $g_sFilePattern = $keys[$j][1]
_SearchDelFile($g_sDirPath, $g_sFilePattern)
Next
Next
Func _SearchDelFile($SearchDir, $SearchFile)
If $SearchDir <> '' Then
Local $search = FileFindFirstFile($SearchDir & "\*.*")
While 1
Dim $file = FileFindNextFile($search)
If @error Or StringLen($file) < 1 Then ExitLoop
If StringRight($SearchDir & "" & $file, StringLen($SearchFile)) = $SearchFile Then
If StringInStr(FileGetAttrib($SearchDir & '\' & $file), "R") Then FileSetAttrib($SearchDir & '\' & $file, "-R")
FileDelete($SearchDir & '\' & $file)
EndIf
_SearchDelFile($SearchDir & "" & $file, $SearchFile)
WEnd
EndIf
EndFunc ;==>_SearchDelFile
|