We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 26310
    • 130 Posts
    Hello all knowing and wise smiley

    I’m stuck on what seems to me to be straight forward but it’s so late I realize I’m seeing crooked!

    I have a script that monitors a folder for activity, records it all to a db and then every now and then sends me an email
    with activity detail. The problem I’m having is I want the script to clean up the DB table at then end of running. Essentially
    delete a record in the table if it can’t find the corresponding filename in the array.

    The way I see it, it seems I should be able to search the array of files for the file name of a record and if it doesn’t come back
    delete that record...

    But I’m absolutely lost on how to compare the two...

    Below is an example of the array I get after opening the directory

    Array
    (
        [0] => Array
            (
                [filename] => /path/to/file
                [type] => dir
                [filesize] => 0
                [datemodified] => 1267931850
            )
    
        [1] => Array
            (
                [filename] => /path/to/file/IMG_5362.JPG
                [type] => image/jpeg
                [filesize] => 1942750
                [datemodified] => 1267931850
            )
    
        [2] => Array
            (
                [filename] => /path/to/file/IMG_5361.JPG
                [type] => image/jpeg
                [filesize] => 1971732
                [datemodified] => 1267931850
            )
    
        [3] => Array
            (
                [filename] => /path/to/file/IMG_5366.JPG
                [type] => image/jpeg
                [filesize] => 2191955
                [datemodified] => 1267931855
            )
    
        [4] => Array
            (
                [filename] => /path/to/file/march.gif
                [type] => image/gif
                [filesize] => 1139
                [datemodified] => 1267654024
            )
    
        [5] => Array
            (
                [filename] => /path/to/file/test
                [type] => dir
                [filesize] => 0
                [datemodified] => 1267931936
            )
    
        [6] => Array
            (
                [filename] => /path/to/file/IMG_5365.JPG
                [type] => image/jpeg
                [filesize] => 2072840
                [datemodified] => 1267931936
            )
    
        [7] => Array
            (
                [filename] => /path/to/file/IMG_5364.JPG
                [type] => image/jpeg
                [filesize] => 221311
                [datemodified] => 1267931932
            )
    
    )
      I twitch because I care....and drink too much coffee.