• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Adding An Extension To Hundreds Of Files At Once?

DasFox

Diamond Member
I'm working on a website for our company, and the person who created this backend system before I was hired, made a PHP backend. When uploading images, it would remove the extension for the jpegs of .jpg, so all I am left with now is a file, that I have to go back and put in .jpg to each one of them so I can open them up and view them.

Is there any way with hundreds of these image files missing the .jpg extension to add them into all of them at once, or am I going to manually have to add it in to each file one by one?

THANKS
 
use the rename command from the command line.

(I'm using dashes instead of spaces for readability)


ren-*.-*.jpg

 
If the images (and just the images) are all in the same folder, you can use

Ren *.* *.jpg

Just use the * (wildcard) as you need to

If the images are all name upload_xxx
Use something like
Ren upload*.* Upload*.jpg
 
Originally posted by: Smilin
use the rename command from the command line.

(I'm using dashes instead of spaces for readability)


ren-*.-*.jpg

So I would change to the directory where they are all at, and run that command?

THANKS
 
Originally posted by: tw1164
If the images (and just the images) are all in the same folder, you can use

Ren *.* *.jpg

Just use the * (wildcard) as you need to

If the images are all name upload_xxx
Use something like
Ren upload*.* Upload*.jpg

Yes all the images are in one folder.

Huh wildcard?

Sorry I don't get it, how exactly do I run this command?
 
Wildcards explained.


The ? character can be used as a substitute for an individual character.
The * character can be a substitute for a whole block characters.


to get an idea of how this works go to say your windows folder in a command prompt and type these commands:

dir *.*
dir a*.*
dir *.exe
dir *.?x?

the command I gave you says:
rename everything with no extenstion: *.
to the same name but with an jpg extension: *.jpg
 
* can also be a subsitute for no characters at all. 🙂

Wouldn't "ren *.* *.jpg" be changing everything after the last dot to jpg rather than adding a ".jpg" to it like "ren * *.jpg"?
 
the "*" is called a wildcard. I can take the place of a string of characters, so *.jpg means anything.jpg. bob.jpg would match it, pr0n.jpg would match it, family_pictures_of_the_dog.jpg would match it. Likewise if you leave off the .jpg and just use * then every single file will match it.

So, basically yeah just change to the directory with all the picture files and run that command from the command line. To further clarify the command, it's:

ren space *.* space *.jpg
 
I got it like Smilin said, and that impressed the Manager in the shop that I was able to do this, LOL

THANKS guys!

ALOHA
 
actually since all your jpeg files have no extension, I believe you should use:

ren space *. space *.jpg
 
Yes, if you have any other files in your folder besides the ones you want to rename, you don't want to use *.*, as all files would then wind up with a .jpg extension.
 
Back
Top