I was wondering what would be the good way to organize documents in a filesystem for my php/mysql application. All info of the docs are stored in a db i am curious about filesystem organization. Is this good way to do it? Is there a better way?
Main folder
/documents
One folder per client
/documents/client1
Documents are uploaded here per client
/documents/client1/queue
After users fill the form docs are saved to a database and moved in this folder
/documents/client1/docs
Original and filesystem names of the document are stored in a database and filesystem name is something like md5($time.$filename.$client_id) and the document path looks like this
/documents/client1/docs/6f99caa11e78697612d8f1b4481cd76a.pdf
I need (minimum) first page of pdf for the thumb and auto barcode reading from the first page
/documents/client1/docs/6f99caa11e78697612d8f1b4481cd76a/6f99caa11e78697612d8f1b4481cd76a-0.gif
I also have
/documents/client1/scan
where files from the scanner goes so users can import them in the database and after that they are renamed and moved to: /documents/client1/docs
I wonder if i should put files for specific date in a date folder like this:
/documents/client1/docs/20110915/6f99caa11e78697612d8f1b4481cd76a.pdf
Or should i use completely different folder structure?