Skip to content

Convert a folder of .JPG-LARGEs to .JPGs

2017 January 1

 

Here’s a method you can use on Windows or Unix to convert any number of files of type .jpeg-large and .jpg-large to type .jpg for easier use with various programs.

This article provides instructions presuming you are on Windows 10 with little or no knowledge of Unix. If you are on Unix, the relevant part below begins with the words “Then activate bash…”.

Step-by-step:

1. Windows 10 ships with the bash shell. (Maybe you have to enable it — I don’t remember. Use your favorite search engine to find out how.)

2. Make a backup copy of your .jpeg-large and .jpg-large files, because this process will change the names irreversibly.

3. Open a command tool / DOS box / command prompt — it’s a program — hit the windows key and search for “cmd”.

4. In the command tool, use the cd command to change directory (a directory is a folder) …
supposing myfolder contains the .jpg-large files …

C:\foo> cd \foobar\myfolder

5. Then activate bash …

C:\foobar\myfolder> bash

6. Then type in each of these lines (you don’t have to type the the comment which starts with # and ends at the end of the line) …


ls                     # show all the files in folder
# LIST of all the jpg-large files
LIST=`ls | grep -i \.jpg-large`
# and all jpeg-large files
LIST=$LIST\ `ls | grep -i \.jpeg-large`
for FILE in $LIST      # for each file in LIST
do
# get new name
NEWF=`echo $FILE | sed 's/\.[^.]*$/\.jpg/' `
      # WARNING: -f overwrites existing .jpg if any
mv -fv $FILE $NEWF     # rename file.
done                   # end of LIST
ls                     # show all the files in folder

7. Then type…

exit

…maybe type exit multiple times to exit the command tool

8. That is all.

ta-da


 

Notes:

Thanks to Jonathan Leffler for the solution to a similar problem in his note of Sep 20 2011 http://stackoverflow.com/questions/7479536/using-awk-to-remove-one-of-multiple-file-extensions .

The photo of the butterfly is a type .jpg-large, converted to jpg.

Comments are closed.