回复 1# yikang8888
以下代码基本能满足你的要求,但是美中不足的地方就是不能手动删除目标文件夹中的txt文件,会失灵的#include <file.au3>
#include <array.au3>
$FileList1 = _FileListToArray("D:\autoit","*.txt", 1)
;_ArrayDisplay($Filelist1)
If $filelist1 <> 0 Then
While 1
$FileList2 = _FileListToArray("D:\autoit","*.txt", 1)
If $filelist2 <> 0 Then
If $Filelist2[0] <> $Filelist1[0] Then
For $i = 1 To $Filelist2[0]
$count = 0
For $j = 1 To $Filelist1[0]
If $filelist2[$i] == $filelist1[$j] Then
ExitLoop
Else
$count += 1
EndIf
Next
If $count >= $filelist1[0] Then
FileCopy("D:\autoit"&$filelist2[$i],"D:\123"&$filelist2[$i],9)
FileDelete("D:\autoit"&$filelist2[$i])
EndIf
Next
EndIf
EndIf
Sleep(100)
WEnd
Else
While 1
$FileList2 = _FileListToArray("D:\autoit","*.txt", 1)
If Not @error Then
For $i = 1 To $filelist2[0]
FileCopy("D:\autoit"&$filelist2[$i],"D:\123"&$filelist2[$i],9)
FileDelete("D:\autoit"&$filelist2[$i])
Next
EndIf
Sleep(100)
WEnd
EndIf
|