I downloaded some files from internet. In the name field of those files each ' '
character is replaced by "%20"
. I want to rename all of those but number of files is too high. So manual approach would be clumsy. I know from command line with regular expression this can be done but I am not very familiar with it. So little help is needed.
Summary is, I want to rename all files in a directory by replacing all "%20"
patterns with " "
. How can I do it?
Sample:
17%20Clipping.cpp --> 17 Clipping.cpp
14%20Mouse%20(Button)%20Listener.cpp --> 14 Mouse (Button) Listener.cpp
I would recommend against putting spaces in filenames (maybe use underscore instead). Regardless, here is a command that will do it:
In its current form it merely prints the commands it would execute. Once you're sure it does what you want, remove the
echo
.As @ronmrdechai suggests, the following is an improvement:
The backslash is needed in the pattern because
%
is a metacharacter (match at end) in this case.you can rename a group of files using command
rename
that accept regular expressionFor example, to rename all files matching "*.bak" to strip the extension, you might say
To translate uppercase names to lower, you'd use
and your answer: