Sign in to follow this  
Followers 0
quicksilver

Find lost files

8 posts in this topic

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.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

; 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 by Geert

Share this post


Link to post
Share on other sites

It Works Fine :lmao:

Big Thanks for the Fast and nice Reply.

Share this post


Link to post
Share on other sites

But how can i fix it that the message only pop up 1 times ?

Share this post


Link to post
Share on other sites

Thanks geert


-jaenster

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

#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 by Geert

Share this post


Link to post
Share on other sites

What this does ?


-jaenster

Share this post


Link to post
Share on other sites

Yeah Big Thanks. It works Fine and it is 100% the tool i need !

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0