What is the easiest way to convert a bunch of text files from LF (Unix) to CRLF (Windows) in a single run?

8,395

for one directory, open a command-prompt window, cd to the desired folder and

for %f in (*.txt) do UNIX2DOS %f ...

or for all subdirectories use the /R option

for /R %f in (*.txt) do UNIX2DOS %f ...

It may be worth remembering that, unlike notepad, editors like wordpad and notepad++ are happy with LF as line endings.

If you are converting a bunch of text files, you might also consider converting to UTF-8 using something like recode or iconv.

Share:
8,395

Related videos on Youtube

Saul
Author by

Saul

Ever felt annoyed by GUI clutter or unnecessary widgets on this site? Meet undercurrent. It's a Google Chrome extension that removes some of them.

Updated on September 18, 2022

Comments

  • Saul
    Saul over 1 year

    There is a directory tree on a Windows7 machine containing a few hundred text files that I want to convert from LF to CRLF.

    I already found a Win32 version of UNIX2DOS but that one accepts only one file at a time for input whereas I want to convert a whole set of directories and subdirectories recursively in a single run.

    What is the easiest way to accomplish that task?