I want to change extensions from mp3
to mp4
to all files in one directory (folder). Is it possible or I need to write a script to do that?
Asked
Active
Viewed 47 times
0

user124942
- 145
- 1
- 9
-
1Does this answer your question? [Rename multiple files by replacing a particular pattern in the filenames using a shell script](https://stackoverflow.com/questions/6840332/rename-multiple-files-by-replacing-a-particular-pattern-in-the-filenames-using-a) – MikeBeaton Apr 03 '22 at 19:04
-
No, actually is not. How do I rename music files `mp3` to `mp4`? – user124942 Apr 03 '22 at 19:18
1 Answers
1
You could imagine something like this:
for f in *.mp3; do
mv $f ${f/.mp3/.mp4}
done
The part with ${x/a/b}
is a string substitution in bash, it replaces a for b in x

Nakor
- 1,484
- 2
- 13
- 23