+4 votes
in Operating Systems by (5.1k points)
edited by
I want to replace the ".jpeg" extension with ".jpg" in all image files in a folder. What bash command should I use to do this?

1 Answer

0 votes
by (32.8k points)

To replace the ".jpeg" extension with ".jpg" in images files in a folder, you can use the "mv" command with the "for" loop.

  • "cd" to the folder where you have kept your image files.
  • run the following command on the terminal.

for file in $(ls *.jpeg);  do mv "$file" "${file%.*}.jpg" ; done

...