同样的问题看到过很多次了,难道就不会先搜索一下论坛?
难道每次都不思考,不搜索就马上跑出来提问?
_filedelete(@ScriptDir&"\backup",'*.jpg',0)
ShellExecute(@ScriptDir&"\backup")
Func _filedelete($path, $ext = '*.*', $flag = 0);_filedelete(路径,[[文件类型],0=不包括子目录,1=包括子目录(当包括子目录时只能用*.*)])
Local $reulst,$abc
If StringRight($path, 1) <> "\" Then $path = $path & "\"
If $flag = 0 Then
$reulst = FileDelete($path&$ext)
Return $reulst
ElseIf $flag = 1 And $ext = '*.*' Then
$search = FileFindFirstFile($path&$ext)
If $search = -1 Then
Return SetError(2)
EndIf
While 1
$file = FileFindNextFile($search)
If @error Then ExitLoop
$abc&=$path&$file&"|"
If FileGetAttrib($path&$file)='D' Then
DirRemove($path&$file,1)
Else
FileDelete($path&$file)
EndIf
WEnd
FileClose($search)
EndIf
EndFunc ;==>_filedelete
|