質問

If I categorize files as binary (eg: .exe, .mp3, .docx, .pdf) and text (eg: rtf, txt, html, xml), then how can we use the classic ASP's FSO to determine what kind of file a particular file is ?

役に立ちましたか?

解決

I looked it up at the Internet all users are the same opinion. There is no direct way to make a difference. Apparently you have to do it manually. This link gives you a set of rules to make a difference between a text and a binary file.

他のヒント

According to Eric Lippert, the FSO isn't meant for binary files. But using .Read(n) to get the first few characters and compare them to known signatures should work.

P.S.

If you do a full scan to classify the data, as reporter porposed, make sure you use more modern rules (e.g. a UTF16 text file could contain 50% 'zeros').

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top