无法确定本地文件类型

I. Introduction

一,引言

There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension. This reminded me of questions that come up here at EE along the lines of, "How can I tell the type of file from its contents?", as well as, "What kind of file has the XXX extension?" Writing an article to address this has been on my to-do list for a long time — the group discussion has inspired me to do it.

专家交流小组中正在进行一个有趣的讨论- 附件,不带扩展名 。 这让我想起了EE中出现的问题,例如“如何从文件内容中区分文件类型?”以及“具有XXX扩展名的文件类型”。 很久以来,写一篇文章来解决这个问题一直在我的工作清单上,小组讨论启发了我去做。

II. Determine the type of file from its XXX extension

二。 从文件的XXX扩展名确定文件的类型

Here are five links that can help in determining what an XXX file is:

以下五个链接可帮助您确定XXX文件是什么:

http://extension.nirsoft.net/XXX

http://extension.nirsoft.net/XXX

https://www.file-extensions.org/XXX-file-extension

https://www.file-extensions.org/XXX-file-extension

http://www.fileinfo.com/extension/XXX

http://www.fileinfo.com/extension/XXX

http://filext.com/file-extension/XXX

http://filext.com/file-extension/XXX

http://www.solvusoft.com/en/file-extensions/file-extension-XXX

http://www.solvusoft.com/en/file-extensions/file-extension-XXX

Simply replace XXX with the file extension of interest. For example,

只需用感兴趣的文件扩展名替换XXX。 例如,

http://extension.nirsoft.net/TIFF

http://extension.nirsoft.net/TIFF

https://www.file-extensions.org/docx-file-extension

https://www.file-extensions.org/docx-file-extension

http://www.fileinfo.com/extension/AHK

http://www.fileinfo.com/extension/AHK

http://filext.com/file-extension/xhtml

http://filext.com/file-extension/xhtml

http://www.solvusoft.com/en/file-extensions/file-extension-opd

http://www.solvusoft.com/en/file-extensions/file-extension-opd

III. Determine the type of file from its contents

三, 根据文件内容确定文件类型

Now to the trickier question! An excellent file identifier application called TrID analyzes the contents of a file in an attempt to figure out what type of file it is. It comes in both a command line interface (CLI) version (for Windows and Linux) and a Graphical User Interface (GUI) version (Windows only) called TrIDNet. The downloads are at the links in the preceding sentence.

现在到棘手的问题! 一个名为TrID的出色文件标识符应用程序分析文件的内容,以试图弄清文件的类型。 它具有命令行界面(CLI)版本 (适用于Windows和Linux)和称为TrIDNet的图形用户界面(GUI)版本 (仅适用于Windows)。 下载位于前一句中的链接。

Both the CLI and GUI versions require a database/library of file definitions. This is a key feature of TrID and TrIDNet — the always increasing list of files that it recognizes. As of this article's submission date, the database contains 6,019 definitions (dated 13-August-2015). Note that there are separate downloads for the CLI definitions and the GUI definitions.

CLI和GUI版本都需要文件定义的数据库/库。 这是TrID和TrIDNet的主要功能-TrID和TrIDNet可以识别的文件列表总是在增加。 截至本文提交之日,该数据库包含6,019个定义 (日期为2015年8月13日)。 请注意, CLI定义和GUI定义有单独的下载。

IV. More about TrID — the CLI version

IV。 有关TrID的更多信息-CLI版本

After downloading the CLI version and its definitions, simply unpack the ZIP file with the program (trid.exe) and copy the definitions file (triddefs.trd) into the same folder as the program file. As mentioned above, using a database of definitions for file types is a really nice feature of TrID. Since file types are frequently added, the program author makes the definitions database available as a separate download, so you may go back to the website occasionally to get the latest definitions file.

下载CLI版本及其定义后,只需使用程序( trid.exe )解压缩ZIP文件,然后将定义文件( triddefs.trd )复制到与程序文件相同的文件夹中。 如上所述,使用文件类型定义数据库是TrID的一个非常不错的功能。 由于经常添加文件类型,因此程序作者可以单独下载定义数据库,因此您有时可能会返回网站以获取最新的定义文件。

Here's the syntax of the CLI version (v2.20):

这是CLI版本(v2.20)的语法:

Usage: TrID <[path]filespec(s)...> [-ae|-ce] [-d:file] [-ns] [-n:nn]
[-@] [-v] [-w] [-?]
Where: <filespec> Files to identify/analyze
-ae        Add guessed extension to filename
-ce        Change filename extension
-d:file    Use the specified defs package
-ns        Disable unique strings check
-n:nn      Number of matches to show (default: 5)
-@         Read file list from stdin
-v         Verbose mode - display def name, author, etc.
-w         Wait for a key before exiting
-?         This help!

The program is free for personal use. Here's exactly what the license says (I took the liberty of correcting typos in it):

该程序免费供个人使用。 这正是许可证所说的内容(我可以纠正其中的错别字):

The program can be freely distributed and is freeware for non-commercial, personal, research and educational use. Contact the author for commercial use or commercialization of TrID or TrID's definitions and contained information.

该程序可以免费分发,并且是非商业,个人,研究和教育用途的免费软件。 联系作者以用于TrID或TrID的定义和所含信息的商业用途或商业化。

I don't want to put the author's email address in this article, but you may find it in the Readme file that is part of the download.

我不想在本文中放入作者的电子邮件地址,但是您可以在下载的自述文件中找到它。

V. More about TrIDNet — the GUI version

V.有关TrIDNet的更多信息-GUI版本

As stated earlier, the definitions for the GUI version are in a different format from the definitions for the command line version. The GUI definitions are in a large number of XML files, one for each file type — currently, 6,019 of them!

如前所述,GUI版本的定义与命令行版本的定义格式不同。 GUI定义包含在大量XML文件中,每种文件类型对应一个XML文件-当前共有6,019个!

As with the CLI version, there's no installation needed — just unpack the ZIP file with the program (TrIDNet.exe) and copy the definitions (all of the XML files) into the same folder as the program file.

与CLI版本一样,不需要安装-只需使用程序( TrIDNet.exe )解压缩ZIP文件,然后将定义( 所有 XML文件)复制到程序文件所在的文件夹中即可。

When running TrIDNet, here's the opening screen:

运行TrIDNet时,这是打开屏幕:

V. Conclusion

五,结论

To come full circle to the group discussion that prompted this article, I fed to both TrID and TrIDNet a file that has 40 characters in the file name but no file extension. Here's the TrID command line with its result (via copy/paste from the command prompt window):

为了使引起本文讨论的小组讨论全面进行,我向TrID和TrIDNet提供了一个文件名,该文件名包含40个字符,但没有文件扩展名。 这是TrID命令行及其结果(通过从命令提示符窗口复制/粘贴):

trid "d:\0tempd\40 character file name without extension"

trid“ d:\ 0tempd \ 40个字符文件名,不带扩展名”

TrID/32 - File Identifier v2.20 - (C) 2003-15 By M.Pontello

TrID / 32-文件标识符v2.20-(C)2003-15通过M.Pontello

Definitions found:  6019

找到的定义:6019

Analyzing...

分析...

Collecting data from file: d:\0tempd\40 character file name without extension

从文件收集数据:d:\ 0tempd \ 40个字符文件名,不带扩展名

100.0% (.PDF) Adobe Portable Document Format (5000/1)

100.0%(.PDF)Adobe可移植文档格式(5000/1)

Here's the TrID GUI result:

这是TrID GUI结果:

Both TrID and TrIDNet easily determined that it is a PDF file — and with 100% certainty. Of course, 100% certainty is not always the case, as shown in this real-life example of a file uploaded in a recent EE question. The file bumped into the 40-character file name limit and wound up with a .x file extension. Here are the TrID results on it:

TrID和TrIDNet都可以轻松确定它是PDF文件,并且具有100%的确定性。 当然,并非总是100%的确定性,如在最近的EE问题中上传的文件的真实示例所示。 该文件达到40个字符的文件名限制,并以.x文件扩展名结尾 。 这是TrID的结果:

TrID/32 - File Identifier v2.20 - (C) 2003-15 By M.Pontello

TrID / 32-文件标识符v2.20-(C)2003-15通过M.Pontello

Definitions found:  6019

找到的定义:6019

Analyzing...

分析...

Collecting data from file: d:\0tempD\Time-Interval-Frequency-calculationv51.x

从文件收集数据:d:\ 0tempD \ Time-Interval-Frequency-calculationv51.x

51.3% (.XLSM) Excel Microsoft Office Open XML Format document (with Macro) (57500/1/12)

51.3%(.XLSM)Excel Microsoft Office Open XML格式文档(带有宏)(57500/1/12)

45.0% (.XLSX) Excel Microsoft Office Open XML Format document (50500/1/11)

45.0%(.XLSX)Excel Microsoft Office Open XML格式文档(50500/1/11)

3.5% (.ZIP) ZIP compressed archive (4000/1)

3.5%(.ZIP)ZIP压缩存档(4000/1)

It is, in fact, a .XLSM file, as predicted by TrID, although with only 51.3% certainty. After changing the file type from .x to .xlsm, it loaded perfectly into Excel.

实际上, 正如TrID预测的那样,它是.XLSM文件,尽管只有51.3%的确定性。 将文件类型从.x更改为.xlsm之后 ,它完美地加载到Excel中。

If you find this article to be helpful, please click the thumbs-up icon below. This lets me know what is valuable for EE members and provides direction for future articles. Thanks very much! Regards, Joe

如果您发现本文有帮助,请单击下面的大拇指图标。 这使我知道什么对EE成员有价值,并为以后的文章提供了指导。 非常感谢! 问候乔

翻译自: https://www.experts-exchange.com/articles/19759/How-to-determine-the-type-of-file-from-its-contents.html

无法确定本地文件类型

无法确定本地文件类型_如何从文件内容确定文件类型相关推荐

  1. data后缀文件解码_小白学PyTorch | 17 TFrec文件的创建与读取

    [机器学习炼丹术]的学习笔记分享<> 小白学PyTorch | 16 TF2读取图片的方法 小白学PyTorch | 15 TF2实现一个简单的服装分类任务 小白学PyTorch | 14 ...

  2. 苹果笔记本怎么找文件夹_求解答mac怎么找文件路径

    死活早已被埋没 回答数:6648  |  被采纳数:39 2017-02-08 11:12:12 1.单击菜单栏右侧的Spotlight图标,显示Spotlight搜索栏: 2.在Spotlight搜 ...

  3. kettle将多个文件压缩_如何使用WinRAR将一个大文件压缩成多个小的压缩包

    目录 1.使用WinRAR将一个大文件压缩成多个小的压缩包 2.使用WinRAR将多个小的压缩包,解压/合并成一个大文件 3.结尾 / 在现实生活中,受文件大小的限制,在传输的过程往往出现困难,如:邮 ...

  4. git 如何忽略掉文件夹_如何使git忽略某些文件或文件夹

    为什么要忽略某些文件或文件夹的变化? git作为一款项目文件变更版本管理软件,其主要功能之一就是追踪项目文件夹内各种文件及文件夹的变更情况.但是,在日常使用中,并非项目文件夹下的所有文件及文件夹变更都 ...

  5. html弹出保存文件对话框_初步了解CAD的模板文件

    样板文件作为一个模板和标准,通常只保留同类图纸共有的一些参数和图形.用好模板可以夫规范作图,可以达到事半功倍的效果!样板文件的扩展名是dwt. 1.在CAD早期版本中,样板文件很好找,因为在CAD的安 ...

  6. android 文件传输_使用“发送到”轻松将文件传输到您的Android设备

    android 文件传输 The "Send to" menu has been around since Windows 95; so long a lot of users m ...

  7. python递归实现文件复制_在python中递归复制文件或目录

    python似乎有复制文件的功能(如shutil.copy)和复制目录的功能(如shutil.copytree),但我没有找到同时处理这两者的功能.当然,检查您是想复制一个文件还是一个目录是很简单的, ...

  8. github 下载单个文件夹_从Github上下载单个文件夹的快速方式

    最近使用python需要从Github上下载文件,但官网上只能下载一个大目录下的所有文件,无法下载单个自己需要的文件夹. 网上主要的解决方式是SVN,有点麻烦没试. 尝试使用了Chrome的GitZi ...

  9. cpp 一个文件分成两个文件写_为ORB-SLAM2写一个launch文件

    在ros下启动ORB-SLAM2的步骤比较繁琐,比如运行单目版本,首先需要启动相机,然后在新的命令窗口下打开ORB-SLAM2的相应节点,这个步骤需要输入配置好的路径等: # ros 启动orb-sl ...

  10. mysql数据库常用字段类型_快速了解MySQL数据库常用字段类型

    数字列类型 int.bigint.smallint.tinyint 数字列类型用于储存各种数字数据,如价格.年龄或者数量.数字列类型主要分为两种:整数型和浮点型.所有的数字列类型都允许有两个选 项:U ...

最新文章

  1. 在一个数组中实现两个堆栈
  2. No module named 'numpy.core._multiarray_umath'
  3. mysql创建表和数据库
  4. kubectl命令自动补全功能
  5. AUTOSAR从入门到精通100讲(三十三)-AutoSar架构中的诊断事件管理
  6. 《Python Cookbook 3rd》笔记(4.5):反向迭代
  7. vue 声明周期函数_vue-router路由守卫-上
  8. sklearn knn 算法
  9. 2022年陕西省职业院校技能大赛中职组网络安全赛项规程
  10. 如何让员工适应CRM客户管理系统
  11. react中使用web worker
  12. 典型相关分析(Matlab实现函数)
  13. 详解脑的功能区域分布以及布罗德曼分区系统
  14. 一起自学SLAM算法:11.5 强化学习与自主导航
  15. 【高速数字化仪应用案例系列】虹科数字化仪在通信领域的应用
  16. kafka问题 Aattempt to heart beat failed since the group is rebalancing
  17. Vue项目使用域名访问配置
  18. 最小重量机器设计问题
  19. 第四章:商品治理五大策略
  20. 光伏组件机器视觉新突破!维视智造上线汇流带引线焊接检测新方案 “误检率”低至0.01%

热门文章

  1. Linux怎么让文件可执行,linux下将资源文件加入可执行文件中
  2. 超市商品陈列原则口诀
  3. 解决Excel中上下左右键相反,且不能一格一格的滑动。
  4. AISG RCU ACU 电调天线远端控制器
  5. win7 64位 调用notepad,但是不能调用键盘osk.exe
  6. 如何防范 DAO 中的治理攻击?
  7. ubuntu 一键挂载U盘到系统
  8. 高级前端必备--设计模式
  9. 《你不可不知的人性》经典语录
  10. 【高速数字化仪应用案例系列】虹科Spectrum在天文领域的应用