#include<file.au3>
#include<Array.au3>
Local $FileDir = "D:\downloads"
Local $arrayFiles = _FileListToArray($FileDir,"*",1)
If @error Then Exit MsgBox(16,"报告","没有找到任何文件在"&$FileDir&"路径下面!")
;_ArrayDisplay($arrayFiles)
For $i = 1 To $arrayFiles[0]
$temp = StringRegExp($arrayFiles[$i],'([^\d]+)\d+\.\w{3}',1) ;正则取文件名(不包括数字)
If @error Then ContinueLoop
If IsDeclared('~'& $temp[0]) Then
FileMove($FileDir & "\" & $arrayFiles[$i],$FileDir & "\" & $temp[0] & "\" )
Else
Assign('~'& $temp[0],"")
DirCreate($FileDir & "\" & $temp[0])
FileMove($FileDir & "\" & $arrayFiles[$i],$FileDir & "\" & $temp[0] & "\" )
EndIf
Next 回复 1# zzwwdd |