Remove Spaces in Media Files

From TNG_Wiki
Jump to navigation Jump to search

For this to work you will have to have SSH access to your server. So don't run the query if you can't get to the server with SSH. (or you might ask your provider to do certain things)

Log into SSH and run the following script in the media folders (and thumb nail folders if you have them but also in all the subdirectories)

Don't do anything before making a proper backup of your database.

ls | while read -r FILE
    mv -v "$FILE" `echo $FILE | tr ' ' '_' `

After that you log into MySQL admin and run the following queries

UPDATE tng_media set mediakey = REPLACE(mediakey," ","_");

UPDATE tng_media set path = REPLACE(path," ","_");

UPDATE tng_media set thumbpath = REPLACE(thumbpath," ","_");

And your done.