I want to check whether any DOS files exist in any specific directory.
Is there any way to distinguish DOS files from UNIX apart from the ^M chars ?
I tried using file, but it gives the same output for both.
$ file test_file
test_file: ascii text
And after conversion:
$ unix2dos test_file test_file
$ file test_file.txt
test_file.txt: ascii text
The CRLF (
\r\n,^M) line endings chars are the only difference between Unix and DOS/Windows ASCII files, so no, there’s no other way.What you might try if you have to
fromdoscommand is to compare its output with the original file:This fails (non-zero
$?) iffromdosstripped any\raway.dos2unixmight be used in a similar way, but I don’t know its exact syntax.