0

I need to merge all files in a directory and its subdirectories into one. Based in solutions, I've this code below (I'd like to improve...):

Set output="evoc.lua"

Del %output%

(
    Type hoist.lua
    Echo.
    Echo.

    For /r "./src/" %%a in (*.lua) do @(
        type "%%a"
    )

    Echo.
    Echo.

    Type "exec.lua"

) >> %output%

It works. Now I need to distinguish files by line breaks (e.g., '\r\n' or \n); I've tried with Echo., but it puts dots (not at all). Any solutionsw

Set output="evoc.lua"

Del %output%

(
    Type hoist.lua
    Echo.
    Echo.

    For /r "./src/" %%a in (*.lua) do @(
        type "%%a"
        Echo.
    )

    Echo.
    Echo.

    Type "exec.lua"

) >> %output%

1 Answers1

0

The problem with echo. is an old friend of batch files. It seems that there is no perfect solution to print new lines that work in all the cases.

These are some alternatives that you can try:

Echo/
Echo\
Echo:
gmanjon
  • 1,483
  • 1
  • 12
  • 16
  • Unfortunately these charaters still appeared in the result file, but after this I've got an idea of putting Lua comments with 2x `Echo --`. Do you think there's something like line.exe, maybe printting line breaks? –  Jul 10 '17 at 00:19
  • 1
    Glad it helped. I'm afraid my knowledge of batch programming doesn't extend too much. Don't know what line.exe is. Looking deeply into the problem I saw people using `echo[` too. Well, I've just read that now you are using `echo(` and that that works fine. Great! – gmanjon Jul 10 '17 at 10:00