Rename multiple files in terminal
You can do it by a terminal command in a directory where these files are located.
rename 's/^video_//' *.mp4
That means select all filenames started with video_
and replace video_
with nothing. I guess s
is for "substitute".
^
shows the beginning of string. If you omit ^
, the first occurrence of video_
will be removed no matter where it is located in the string. But in your case it does not really matter.
Note: Ubuntu versions above 17.04 don't ship with rename
package, however you can still install it from default repositories via sudo apt install rename
Using
rename
(prename
) :rename -n 's/^video_//' video_*.mp4
If you are satisfies with the changes that are going to be made, remove
-n
to let the operation happens actually :rename 's/^video_//' video_*.mp4
Using
bash
parameter expansion :for file in video_*.mp4; do mv -i "$file" "${file#video_}"; done
${file#video_}
is the parameter expansion pattern to removevideo_
from the start of the file names.
Or
for file in video_*.mp4; do mv -i "$file" "${file/video_/}"; done
This one assumes
video_
comes only once in file names${file/video_/}
is abash
parameter expansion pattern that will replacevideo_
from file names with blank.
Using rename
rename 's/^video_//' *.mp4