@hyknife, Linux下有file命令,这个命令采用读取文件头部信息的方式来判断文件类型,不依赖于扩展名。并且它所提供的信息远不止文件实际格式。比如,对于图片文件,它显示图片实际格式,尺寸之类。对于word文档,就像这样:
$ file 亚当·斯密_《国富论》.doc
亚当·斯密_《国富论》.doc: Composite Document File V2 Document, Little Endian, Os: Windows, Version 5.1, Code page: 936, Template: Normal, Last Saved By: Normal, Revision Number: 2, Name of Creating Application: Microsoft Office Word, Total Editing Time: 09:00, Create Time/Date: Thu Oct 11 02:29:00 2007, Last Saved Time/Date: Fri Jun 19 10:16:00 2009, Number of Pages: 194, Number of Words: 88278, Number of Characters: 503186, Security: 0
|