Difference between revisions of "ReNamer:Rules:Extension"

From den4b Wiki
Jump to navigation Jump to search
(Filename starts with a dot)
 
(13 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{Template:Cleanup}}
+
{{Go|up=ReNamer:Rules|prev=ReNamer:Rules:Rearrange|next=ReNamer:Rules:Strip}}
  
 
== Extension Rule ==
 
== Extension Rule ==
[[Image:ExtensionsRule.png]]
 
  
 +
<center>[[Image:ExtensionsRule.png]]</center>
  
Sometimes a file has a wrong extension. In other cases the extension is missing altogether.
+
This rule allows you to attach a new extension. It is useful when the extension of a file is missing (or if the file has a wrong extension). There is an option to find the correct extension based on the file's structure.  
This rule attaches the specified extension to the base file name.
 
  
The parameters are as follows:
+
The parameters are as follows:  
  
{| class="prettytable"
+
{| class="wikitable"
!Parameter
+
|-
!Details
+
! Parameter  
 +
! Details
 +
|-
 +
| New extension
 +
| New extension that has to be added to the filename.
 +
 
 +
|-
 +
| Append to the original filename
 +
| If this option is selected, the new extension will be placed after the old extension.
 +
If it is deselected (default option) the new extension will replace the old one.
  
 
|-
 
|-
| New extension
+
| Detect using binary signature
| Simply adds the new extension to the file name.
+
| Try to detect a correct file extension using built-in [[#Binary signatures|Binary signatures]] of commonly used files.
 +
|}
 +
 
 +
=== Binary signatures ===
 +
 
 +
Sometimes the extension of a file is missing. At other times it is simply wrong, e.g. some downloaded files get the '''aspx''' extension, although they may ''actually'' be '''zip '''or '''pdf''' files. One way to identify the file extension is by trial-and-error: Attach different extensions and try to open the file with its associated application. This is very tedious.  
  
* ReNamer does ''not'' add a dot between the file name and the extension. So if the dot is missing in the file name, just enter a dot ''before'' the extension in this box. For example, instead of entering just '''pdf''', enter '''.pdf'''.
+
A far more efficient way is to compare the file's ''digital signature'' with the signatures of known file types and identify the file's type. This is done internally within ReNamer, so you do not have to know what a ''digital signature'' means, or the actual value of the signature for the given file.  
  
|-
+
Note that each extension has a range of signatures, and these ranges overlap. This means a given file's signature may match with the signature of several different extensions. In such cases, ReNamer shows the New filename with all matching extensions. For example, "<tt>fileName.wma|wmv|asf</tt>". ReNamer also pops up an error window (because the combined extension is invalid). Just read the suggested extensions and then try them out one by one. This method is still better compared to making wild guesses, because ReNamer suggests only 2-3 extensions.
| Append to the original filename
+
 
| If this option is deselected, the new extension will replace the old extension. (This can be used if the file has a wrong extension, for example.)
+
For more accurate results, use [[ReNamer:Scripts:TrID|ReNamer with TrID library]], a specialized utility for identifying the file's real extension. Be aware that even TrID often suggests multiple extensions, and you may still have to try them out.
  
If the option is selected, the new extension is just added (This can be used when the file does not have any extension at all).
+
=== Filename starts with a dot ===
  
|-
+
Many operating systems treat the dot at the start of the filename as an indicator that the file should be hidden. For that reason, the dot at the start of the filename is not considered as a file extension delimiter.
| Detect using binary signature
 
| Sometimes the extension of a file is missing. At other times it is wrong (e.g. some downloaded files get the '''aspx '''extension, although they may be '''zip '''or '''pdf'''.)
 
  
One way to identify the file extension is by trial-and-error: Attach different extensions and try to open the file with its associated application. This is very tedious.
+
This behavior can be toggled via an option in the settings file:
  
A far more efficient way is to compare the file's ''digital signature ''with the signatures of known file types and identify the file's type. This is done internally within ReNamer, so you do not have to know what a "digital signature" means, or the actual value of the signature for the given file.
+
<pre>FirstDotAtFileNameStartIsExtension=1</pre>
  
Note that several extensions have overlapping digital signatures. Thus, once a digital signature is calculated for a file, ReNamer has to guess its extension. But compared to the trial-and-error method, we have to deal with far fewer extensions here.
+
The settings file is normally located in the [[Application Data Storage]].
  
For better results, [http://www.den4b.com/forum/viewtopic.php?id=550 use ReNamer with TrID], a specialized utility for identifying the file's real extension.
+
Examples of filenames and their considered extension depending on the value of the option:
  
 +
{| class=wikitable
 +
! Filename
 +
! Extension if 1
 +
! Extension if 0
 +
|-
 +
| file.ext
 +
| .ext
 +
| .ext
 +
|-
 +
| .file.ext
 +
| .ext
 +
| .ext
 +
|-
 +
| .file
 +
| .file
 +
|
 
|}
 
|}
 +
 +
 +
[[Category:ReNamer]]

Latest revision as of 20:32, 22 September 2023

Extension Rule

ExtensionsRule.png

This rule allows you to attach a new extension. It is useful when the extension of a file is missing (or if the file has a wrong extension). There is an option to find the correct extension based on the file's structure.

The parameters are as follows:

Parameter Details
New extension New extension that has to be added to the filename.
Append to the original filename If this option is selected, the new extension will be placed after the old extension.

If it is deselected (default option) the new extension will replace the old one.

Detect using binary signature Try to detect a correct file extension using built-in Binary signatures of commonly used files.

Binary signatures

Sometimes the extension of a file is missing. At other times it is simply wrong, e.g. some downloaded files get the aspx extension, although they may actually be zip or pdf files. One way to identify the file extension is by trial-and-error: Attach different extensions and try to open the file with its associated application. This is very tedious.

A far more efficient way is to compare the file's digital signature with the signatures of known file types and identify the file's type. This is done internally within ReNamer, so you do not have to know what a digital signature means, or the actual value of the signature for the given file.

Note that each extension has a range of signatures, and these ranges overlap. This means a given file's signature may match with the signature of several different extensions. In such cases, ReNamer shows the New filename with all matching extensions. For example, "fileName.wma|wmv|asf". ReNamer also pops up an error window (because the combined extension is invalid). Just read the suggested extensions and then try them out one by one. This method is still better compared to making wild guesses, because ReNamer suggests only 2-3 extensions.

For more accurate results, use ReNamer with TrID library, a specialized utility for identifying the file's real extension. Be aware that even TrID often suggests multiple extensions, and you may still have to try them out.

Filename starts with a dot

Many operating systems treat the dot at the start of the filename as an indicator that the file should be hidden. For that reason, the dot at the start of the filename is not considered as a file extension delimiter.

This behavior can be toggled via an option in the settings file:

FirstDotAtFileNameStartIsExtension=1

The settings file is normally located in the Application Data Storage.

Examples of filenames and their considered extension depending on the value of the option:

Filename Extension if 1 Extension if 0
file.ext .ext .ext
.file.ext .ext .ext
.file .file