Batch convert unix to dos format

Batch convert unix to dos format

1
NewbieNewbie
1

    Oct 25, 2009#1

    Hello,

    I searched the forums but could not find an answer to this question. I know I can convert 1 file but how can I convert a whole folder?

    Regards, Tom

    6,604548
    Grand MasterGrand Master
    6,604548

      Oct 26, 2009#2

      There is the script Convert all open files to DOS line terminators.

      But much faster is to use Search - Replace in Files. Open this dialog, enter as search string ^n and as replace string ^r^n and run this NON regular expression replace on all files in a directory (recursively). If your directory (structure) contains also already DOS files. Run a second replace in files searching for ^r^r^n and replace it with ^r^n to fix the wrongly inserted carriage return in the DOS files.
      Best regards from an UC/UE/UES for Windows user from Austria

      16
      Basic UserBasic User
      16

        Nov 29, 2009#3

        Or, you can run a single Perl regular expression replace that will modify only Unix files (and will leave DOS files alone)

        Code: Select all

        Find What:
        (?<!\r)\n
        Replace With:
        \r\n
        The (?<!\r)\n expression says: "match a newline, but only if it is not preceded by a carriage return."
        Negative lookbehind subexpressions (using (?<! ...) syntax) can be very handy!