سؤال

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