quicksilver Posted February 7, 2006 Posted February 7, 2006 Hello i've got a Folder with 20.000 files. There are 4 types of Files *.idy, *.txt,*.pdf and *.rdy . The files are all generated.. and one or two files are missing. No i want to find the missing files.. The way to find the missing files is to check with every name all the 4 file types. For Every Name like "LP200202000013_00005083" exists one file with the ending .pdf .txt .idx and .rdy. The tool now had to check if exists vor every name 4 files. If not list the missing files in a popup message or a logfile. Can anyone Help me? German: Hallo ich brauche ein Tool welches die Vollständigkeit für ein Bestimmten namen überprüft. Ich habe 4 Dateiendungen mit jeweils dem Selben Namen. Ich habe die Endungen *.idy, *.txt,*.pdf und *.rdy. Für jede dieser Endungen gibt es genau den selben Dateinamen, wie z.b. "LP200202000013_00005083". Für diesen Namen exisitiert dann eine Datei mit der Endung pdf idx txt und rdy. Ich muss nun die Files finden die fehlen. Es kann halt sein das eine Datei mit der endung rdy fehlt oder pdf oder txt. Ich muss also nun "nur" prüfen ob es die datei LP200202000013_00005083.pdf und LP200202000013_00005083.rdy und LP200202000013_00005083.txt und LP200202000013_00005083.idx gibt dann zur nächsten datei und dann wieder prüfen ob es davon 4 gibt.
Geert Posted February 7, 2006 Posted February 7, 2006 (edited) expandcollapse popup; Shows the filenames of all files in the current directory, note that "." and ".." are returned. $search = FileFindFirstFile("*.*") ; Check if the search was successful If $search = -1 Then MsgBox(0, "Error", "No files/directories matched the search pattern") Exit EndIf While 1 $file = FileFindNextFile($search) If @error Then ExitLoop $attrib = FileGetAttrib($file) If @error Then MsgBox(4096, "Error", "Could not obtain attributes.") Exit Else If Not StringInStr($attrib, "D") And $file <> @ScriptName Then $name = StringTrimRight($file, 4) If Not FileExists($name & ".idy") Then MsgBox(48, "Missing file", $name & ".idy") EndIf If Not FileExists($name & ".txt") Then MsgBox(48, "Missing file", $name & ".txt") EndIf If Not FileExists($name & ".pdf") Then MsgBox(48, "Missing file", $name & ".pdf") EndIf If Not FileExists($name & ".rdy") Then MsgBox(48, "Missing file", $name & ".rdy") EndIf EndIf EndIf WEnd ; Close the search handle FileClose($search) MsgBox(64, "", "Ready") Just a raw start. The missing file is displayed 3 times Put this script in the directory where your 20.000 files are Edited February 7, 2006 by Geert
quicksilver Posted February 7, 2006 Author Posted February 7, 2006 It Works Fine Big Thanks for the Fast and nice Reply.
quicksilver Posted February 7, 2006 Author Posted February 7, 2006 But how can i fix it that the message only pop up 1 times ?
Geert Posted February 7, 2006 Posted February 7, 2006 (edited) expandcollapse popup#Include<Array.au3> Dim $Array[1] $Array[0] = "0" ; Shows the filenames of all files in the current directory, note that "." and ".." are returned. $search = FileFindFirstFile("*.*") ; Check if the search was successful If $search = -1 Then MsgBox(0, "Error", "No files/directories matched the search pattern") Exit EndIf While 1 $file = FileFindNextFile($search) If @error Then ExitLoop $attrib = FileGetAttrib($file) If @error Then MsgBox(4096, "Error", "Could not obtain attributes.") Exit Else If Not StringInStr($attrib, "D") And $file <> @ScriptName Then $name = StringTrimRight($file, 4) $Pos = _ArraySearch ($Array, $name) Select Case $Pos = -1 ; MsgBox(0, "Not Found", '"' & $name & '" was not found in the array.') If Not FileExists($name & ".idy") Then MsgBox(48, "Missing file", $name & ".idy") EndIf If Not FileExists($name & ".txt") Then MsgBox(48, "Missing file", $name & ".txt") EndIf If Not FileExists($name & ".pdf") Then MsgBox(48, "Missing file", $name & ".pdf") EndIf If Not FileExists($name & ".rdy") Then MsgBox(48, "Missing file", $name & ".rdy") EndIf _ArrayAdd($Array, $name) Case Else ; MsgBox(0, "Found", '"' & $name & '" was found in the array at pos ' & $Pos & ".") EndSelect EndIf EndIf WEnd ; Close the search handle FileClose($search) MsgBox(64, "", "Ready")Use the latest Beta for the _ArraySearch function Edited February 7, 2006 by Geert
quicksilver Posted February 7, 2006 Author Posted February 7, 2006 Yeah Big Thanks. It works Fine and it is 100% the tool i need !
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now