Read a database to determine if, insert data or not

0

I have inserted the data of a directory that I already visited, but if I want to go through the same directory with different files inside, I do not want the files that were already read and stored to be stored in the database again.

Any ideas .. that you can share.

foreach ($iterator as $regex) {
    echo $regex->getPath() ." -- ". $regex->getFilename() ." -- ". $regex->getSize() ." -- ". 
         $regex->getExtension() ." -- ". $regex->getType() . " -- " . date("Y-m-d | H:i:s", filemtime($regex)) . "\n";

    $directorio = new Directorio();
    $directorio -> setRuta($regex->getPath())
                -> setNombre($regex->getFilename())
                -> setExtencion($regex->getExtension())
                -> setTipo($regex->getType()) 
                -> setSize($regex->getSize())
                -> setFechaM(date("Y-m-d | H:i:s", filemtime($regex)));
    $entityManager -> persist($directorio);
  }
    
asked by Paulo Mayoral 05.09.2018 в 20:42
source

0 answers