Slightly SQuirreLy question
I have a potential problem which I've just started thinking about, but thought it might be a fun one to share. It's nothing major, I've just not had to do this before.
There's a directory of files on the server. Those files are listed in a mySQL table. However sometimes several files might appear via FTP without being uploaded through a form which handles writing their details into the table.
So I want a routine that scans the directory for files that are not in the table.
The question: How would you compare a directory list to a SQL table and report which files are orphans? It needs to scale well, as eventually there may be up to 9999 files. Right now there's around 500. I'm trying to work out an efficient way of doing this that wont sit there for minutes churning through the list.
There's a directory of files on the server. Those files are listed in a mySQL table. However sometimes several files might appear via FTP without being uploaded through a form which handles writing their details into the table.
So I want a routine that scans the directory for files that are not in the table.
The question: How would you compare a directory list to a SQL table and report which files are orphans? It needs to scale well, as eventually there may be up to 9999 files. Right now there's around 500. I'm trying to work out an efficient way of doing this that wont sit there for minutes churning through the list.
