Move the uploads folder in Wordpress

Posted by Victor Hurdugaci on Server Fault See other posts from Server Fault or by Victor Hurdugaci
Published on 2010-05-05T08:35:19Z Indexed on 2010/05/05 8:38 UTC
Read the original article Hit count: 272

Filed under:
|
|
|

Currently, my Wordpress' upload folder is located in \wp-content\uploads. Initially there was no structure so all files were put there. After a while it was changed to upload the files in \wp-content\uploads\YEAR\MONTH. Now that folder contains a mix of files (those starting with + are folders) like:

+wp-content
|  +2010
|  |  +02
|  |  |  File-1
|  |  |  File-2
|  |  |  ..
|  |  |  File-n  
|  |  +01
|  |  |  File-1
|  |  |  File-2
|  |  |  ..
|  |  |  File-n 
|  +2009
|  |  +12
|  |  |  File-1
|  |  |  File-2
|  |  |  ..
|  |  |  File-n  
|  |  +11
|  |  |  File-1
|  |  |  File-2
|  |  |  ..
|  |  |  File-n  
|  +..
|  |  |  ..
|  Unstructured-file-1
|  Unstructured-file-2
|  ...
|  Unstructured-file-n

Based on the dates of the unstructured files, I would like to move them in a structured hierarchy (based on date, move it to a folder \wp-content\uploads\YEAR\MONTH).

Now, my questions are:

  1. Where do I write and execute a script to the movement (I don't have full access to the server, just to a cPanel and to the Wordpress Admin page)?
  2. What must be updated so that the links in posts, that reference the unstructured files, point to the new location of those files?
  3. Not fully related to the previous description: is it alright to move the whole uploads folder to another location, like \uploads?

PS: Moving the files/updating the database manually is not an option :)

© Server Fault or respective owner

Related posts about Wordpress

Related posts about files