Originally Posted by Riboflavin
I have several thousand files that were uploaded to my site that are all stored in one big folder. I'd like to separate them out into folders by date. Each upload has a mysql row associated with it that includes the upload date/time, so I can write a script to go through and move them into appropriate folders. My question is, how would I make sure that these files are still accessible through their old/original URLs?
For example, right now a file might be located at http://example.com/files/abcdef.png
and after I move it, it would be located at something like http://example.com/files/2013/02/14/abcdef.png
how would I make the original URL load this file? Would there need to be a mysql query each time a file is loaded to determine where it is stored?
What advantage do you get by actually moving them, or copying them to a folder ? Why not just use the database to make up text files that list the uploaded files by the date ? Then if someone needs to access a file by date they wouldn't have to search the whole database to find them. And you wouldn't have to move them. You could periodically update those listings.