Apr 14 2008

How to rename weird files with spaces and strange characters

Tag:tepezcuintle @ 21:42

I found a post on webhosting talk with a question on how to rename strange files that have spaces and weird characters.

for example files like this

Movie_46_(Dark sector brutal59).flv
Movie_46_(Dark sector brutal59).wmv

as you can see there are weird characters like ( ) and spaces.
so here is a quick way to rename those files.

Here is an example i ran on my machine to see it works.


Here is an example I ran on my own server
#################################

I created the files

touch "Movie_46_(Dark sector brutal59).flv"
touch "Movie_46_(Dark sector brutal59).wmv"

#########################

Then i run my rename command one liner

[marcopenguin@penguin movies]$ rename “(” “” * ; rename “)” “” * ; rename ” ” “” ; rename ” ” “” * ; rename ” ” “” *

############ here is the result of the ls command listing the renamed files ###########

[marcopenguin@penguin movies]$ ls
Movie_46_Darksectorbrutal59.flv Movie_46_Darksectorbrutal59.wmv

Lascia una risposta