本帖最后由 jwwlchen 于 2013-9-8 11:15 编辑
一系列如下面的文件,红色部分是序列号,有些序列号有NG和OK的文件,但有些序列号只有NG的文件,我想将那些只有NG序列号的文件移到指定文件夹中,
以前使用批处理处理的,现在想转成Autoit要怎么实现啊?我的这段代码有问题,不能完全移除,请帮忙看下问题在哪里?set LogPath=G:\Log\20130905
cd /d %LogPath%
for /f "tokens=1,2* delims=_" %%i in ('dir /b *NG*') do (
if exist %%j*OK* move /y %%i_%%j_%%k G:\NG
)
#include <File.au3>
#include <Array.au3>
Move_NG_Log()
Func Move_NG_Log()
Local $PSearch = FileFindFirstFile("*NG*.txt")
If $PSearch = -1 Then Return
While 1
Local $PFile = FileFindNextFile($PSearch)
If @error Then ExitLoop
If @extended Then
Move_NG_Log()
ContinueLoop
EndIf
Local $SN_Info = StringSplit($PFile, "_", 1)
If Not FileExists ("*" & $SN_Info[2] & "*OK.txt") Then
FileMove ($PFile ,"G:\NG" ,9)
EndIf
WEnd
EndFunc
S1_D9OKCT00011800_2013_09_05_13_26_33_OK.txt
S1_D9OKCT00131100_2013_09_05_13_30_26_NG.txt
S1_D9OKCT00131100_2013_09_05_19_17_49_OK.txt
S1_D9OKCT01398600_2013_09_05_14_58_47_NG.txt
S2_D9OKCT00135300_2013_09_05_19_12_16_OK.txt
S2_D9OKCT01264200_2013_09_05_18_44_49_NG.txt
S2_D9OKCT01398600_2013_09_06_12_58_31_OK.txt |