Change ALL extensions in a folder

Joined
Oct 26, 2010
Messages
6
Reaction score
0
Points
1
Location
Ventura County
Your Mac's Specs
iMac 10.6.4 3.06 Core 2 Duo and MBPro 2.53 Core 2
i have a folder of 7,000 images that need to have .jpg appended to all. how might i do this quickly so i can get them uploaded to Amazon store. Using MacPOS X and it doesn't care about the image extension.

Thanks for helping the temporarily brain dead. Google was not my friend on this search.:p
 
Joined
Mar 17, 2009
Messages
3,626
Reaction score
111
Points
63
Your Mac's Specs
2018 15" MBP, 2019 11" iPad Pro, iPhone 11 Pro
Are they currently jpg's or some other file type that need to be changed to jpg's?
I ask because you might just need to turn on "Show All File Type Extensions" in Finder preferences.
Or they might need to be converted as a batch and there are ways of doing that too.
 
OP
TotaTua
Joined
Oct 26, 2010
Messages
6
Reaction score
0
Points
1
Location
Ventura County
Your Mac's Specs
iMac 10.6.4 3.06 Core 2 Duo and MBPro 2.53 Core 2
Are they currently jpg's or some other file type that need to be changed to jpg's?
I ask because you might just need to turn on "Show All File Type Extensions" in Finder preferences.
Or they might need to be converted as a batch and there are ways of doing that too.

they are currently NOTHING or some have extensions which will be easy enough to change a handful rather than a gazillion
 
Joined
Mar 17, 2009
Messages
3,626
Reaction score
111
Points
63
Your Mac's Specs
2018 15" MBP, 2019 11" iPad Pro, iPhone 11 Pro
Did you try turning on Show all filename extensions?
 
Joined
Jul 2, 2007
Messages
3,494
Reaction score
204
Points
63
Location
Going Galt...
Your Mac's Specs
MacBookAir5,2:10.13.6-iMac18,3:10.13.6-iPhone9,3:11.4.1
You could cd to the directory and type this script in, hitting the enter key after each line...

ls > file
for i in `cat file`; do
mv $i $i.jpg
done
 
OP
TotaTua
Joined
Oct 26, 2010
Messages
6
Reaction score
0
Points
1
Location
Ventura County
Your Mac's Specs
iMac 10.6.4 3.06 Core 2 Duo and MBPro 2.53 Core 2
Did you try turning on Show all filename extensions?

Thanks yes i did. these files have no extensions currently because they weren't needed originally.
 
OP
TotaTua
Joined
Oct 26, 2010
Messages
6
Reaction score
0
Points
1
Location
Ventura County
Your Mac's Specs
iMac 10.6.4 3.06 Core 2 Duo and MBPro 2.53 Core 2
You could cd to the directory and type this script in, hitting the enter key after each line...

ls > file
for i in `cat file`; do
mv $i $i.jpg
done

have no idea how to do what you have suggested. that is similar to something i did long ago and far away on a pc. is this a terminal operation? sorry for being dense.
 
Joined
Jul 2, 2007
Messages
3,494
Reaction score
204
Points
63
Location
Going Galt...
Your Mac's Specs
MacBookAir5,2:10.13.6-iMac18,3:10.13.6-iPhone9,3:11.4.1
Yep. Just open the terminal.app and cd to the directory the files are in. Tpye pwd to double check you are in the correct directory.
 
Joined
Jul 2, 2007
Messages
3,494
Reaction score
204
Points
63
Location
Going Galt...
Your Mac's Specs
MacBookAir5,2:10.13.6-iMac18,3:10.13.6-iPhone9,3:11.4.1
Here's an example where I do this in a directory called /Users/username/test on four files named test1, test2, test3 and test4:

MacGyver:test username$ pwd
/Users/dcram/test
MacGyver:test username$ ls > file
MacGyver:test username$ for i in `cat file`; do
> mv $i $i.jpg
> done
MacGyver:test username$ ls
file.jpg test1.jpg test2.jpg test3.jpg test4.jpg
MacGyver:test username$ rm file.jpg
MacGyver:test username$ ls
test1.jpg test2.jpg test3.jpg test4.jpg
MacGyver:test username$
 
OP
TotaTua
Joined
Oct 26, 2010
Messages
6
Reaction score
0
Points
1
Location
Ventura County
Your Mac's Specs
iMac 10.6.4 3.06 Core 2 Duo and MBPro 2.53 Core 2
Here's an example where I do this in a directory called /Users/username/test on four files named test1, test2, test3 and test4:
THANK YOU, so can i assume that dos commands work in Terminal? i have been reluctant to work in terminal b/c of horror stories. Your script made it easy peasy!
 
Joined
Jul 2, 2007
Messages
3,494
Reaction score
204
Points
63
Location
Going Galt...
Your Mac's Specs
MacBookAir5,2:10.13.6-iMac18,3:10.13.6-iPhone9,3:11.4.1
Glad it worked. These are Unix commands, not DOS. Similar but different so please never try running DOS commands on a Mac. ;)
 
OP
TotaTua
Joined
Oct 26, 2010
Messages
6
Reaction score
0
Points
1
Location
Ventura County
Your Mac's Specs
iMac 10.6.4 3.06 Core 2 Duo and MBPro 2.53 Core 2
Glad it worked. These are Unix commands, not DOS. Similar but different so please never try running DOS commands on a Mac. ;)

so how would i modify the script for an if command.
if the extension is .doc don't change is what I am trying to do.
it is the wildcards that i don't understand.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top