PDA

View Full Version : Mass-converting of MS-DOS ASCII TXT files to Windows



1ST1
October 11th, 2017, 01:25 PM
Hello, I have a large bunch of MS-DOS ASCII (code page 437, german) files here and I need to convert them into Windows TXT files. Sounds stupid, but it is about the german Umlauts and sharp . So I would need a converting tool which can be pointed to a directory with all these files (hundreds) and automatically convert them to a target directory.

Anything known?

GeoffB17
October 11th, 2017, 02:22 PM
I'm not sure there is such a thing, there may be something near, but would it do the job fully?

If it was me, I'd just write a fairly simple prog using BASIC. Another language like C would add access to the FINDFIRST/FINDNEXT facilities to step through all the files, but you can get around that with BASIC by doing a DIR *.* >files.lst to create a separate file with a list of all the files to convert, and then step through that file to get the filenames to convert.

Then you'd just need a table of the various characters to convert, and what to convert each one to. No need to be too clever. Open the file as random, record length 1 byte, and step through each file byte by byte, read from source, write to destination, copy the OK chars unaltered, change the ones in the table as per the table. Don't worry about performance/efficiency, just get the job done.

Does the CR/LF format stay the same?

Geoff

Xacalite
October 11th, 2017, 04:08 PM
On Linux, try the following:

for i in *.txt ; do iconv -f 437 -t WINDOWS-1250 -o $i.win $i ; done

On other systems... uhm... search for iconv port to your system?

krebizfan
October 11th, 2017, 05:13 PM
A simple program for Windows is described at http://www.dostips.com/forum/viewtopic.php?t=7570

I think the automated conversion programs like Word for Word could do this. A simple macro with any of the major word processors should manage to iteratively import and then export with the defined code pages. Word processor would be slower though.

Chuck(G)
October 11th, 2017, 05:26 PM
On Linux, try the following:

for i in *.txt ; do iconv -f 437 -t WINDOWS-1250 -o $i.win $i ; done

On other systems... uhm... search for iconv port to your system?

https://github.com/win-iconv/win-iconv

is a port of iconv to Win32.

bocke
October 12th, 2017, 12:57 AM
for i in *.txt ; do iconv -f 437 -t WINDOWS-1250 -o $i.win $i ; done

With Windows port you can do something similar:


for %I in (*.txt) do iconv.exe -f 437 -t WINDOWS-1250 -o %I.win %I

or for UTF 8:

for %I in (*.txt) do iconv.exe -f 437 -t UTF-8 -o %I.win %I

1ST1
October 13th, 2017, 02:02 AM
Thanks I will try the Windows version.

1ST1
October 13th, 2017, 10:53 AM
In case somebody searches exe Version of the tool, it's here: https://dbaportal.eu/2012/10/24/iconv-for-windows/

The sourceforge link is only sourcecode. Tomorrow I will export the txt files from the DOS system.