Solved

figuring out extensions

Posted on 2014-03-20
8
213 Views
Last Modified: 2014-03-25
make a text file
compress it
rename it to .jpg
compress it again
 rename it to .jpg

it is not a .jpg, but will allowed to say so.

why did windows allow this? is it just a way to anonymize a file, if need be?

when you rename a extension, does it corrupt the file by any chance?

if the extension is renamed, is there any tool to extract the original extension in which it was created?
0
Comment
Question by:25112
8 Comments
 
LVL 76

Assisted Solution

by:GrahamSkan
GrahamSkan earned 144 total points
ID: 39942668
In general, extensions are just a convenience. They are functional in finding the correct application to open with file with if you double-click on one in Windows explorer. Changing the extension does not, by itself, change the file content.

It isn't clear why you would want to do such a series of actions
0
 
LVL 76

Assisted Solution

by:GrahamSkan
GrahamSkan earned 144 total points
ID: 39942675
The format of many file types can be determined or guessed at by looking at the contents, but there is no systematic way of doing so. If successful the original extension can be inferred.
0
 
LVL 34

Assisted Solution

by:Dan Craciun
Dan Craciun earned 71 total points
ID: 39942684
You could rename a jpg to png and the browsers and Windows Photo Viewer will still display it without problems, so I guess they test if the file has the right extension, and decide upon the header, kind of like in Linux.

Try to load a jpg renamed in png in Photoshop though, and all you'll get is an error.

My point is that it's the application's choice to trust that the extension is correct or not.

HTH,
Dan
0
 
LVL 14

Assisted Solution

by:Don Thomson
Don Thomson earned 71 total points
ID: 39942693
The only way to do it would be something like

Orig File   Text.txt
Compress it to Text.zip
Rename to Text.txt.jpg
Compress it to Text.txt.zip
rename it to Text.txt..zip.jpg
0
Don't lose your head updating email signatures!

Do your end users still have the wrong email signature? Do email signature updates bore you or fill you with a sense of dread? You can make this a whole lot easier on yourself by trusting an Exclaimer email signature management solution. Over 50 million users do...so should you!

 
LVL 58

Assisted Solution

by:Gary
Gary earned 71 total points
ID: 39942703
The extension is pretty much just an indicator of what type of file it is and what program to use to open it with.
0
 
LVL 62

Assisted Solution

by:☠ MASQ ☠
☠ MASQ ☠ earned 71 total points
ID: 39942705
You can change a file extension to whatever you like, like changing the file name it has no effect on the content. However Windows has historically used file extensions to inform its Open With... command so most people will have an entry in their Windows registry that says if it ends with .jpg then treat it as a JPEG graphics format and open it with an appropriate program.  It's just a shorthand and makes the assumption that users will adopt a standard naming policy, as you describe it can be used to hide the true format of a file (sometimes maliciously).

The best way to get to the identify of a file is to look at the Hex signature in the file header though - if that's "FF D8 FF" then chances are whatever the file name and extension is it's probably a JPEG - some cleverer multimedia packages already look at the file header and will warn you if that and the file extension don't seem to be the same file type.

Although I said files aren't damaged simply by changing the file extension they can be harmed if they are then opened by the wrong program as a result.  Changing a .jpg extension to .txt and then opening and saving the file in a text editor rather than graphics program as a result might well convert the data from something like Unicode to ANSII rendering it useless if the file extension is changed back to its original setting.
0
 
LVL 48

Accepted Solution

by:
dbrunton earned 72 total points
ID: 39943226
>>  if the extension is renamed, is there any tool to extract the original extension in which it was created?

There are utils to determine what the file content is and thus the correct extension.

Examples:

Trid

Other Tools
0
 
LVL 5

Author Comment

by:25112
ID: 39954895
thanks- it helped me out
0

Featured Post

Will my email signature work in Office 365?

You've built an email signature using raw HTML code in Office 365, but you can't review how it looks with Transport Rules. So you have to test it over and over again before it can be used. Isn't this a bit of a waste of your time? Wouldn't a WYSIWYG editor make it a lot easier?

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now