Append multiple files, add $ between each one

June 9, 2009 at 12:58:34
Specs: Windows XP
Goal: Create one file with contents of multiple text files + insert a $ between each file.

example:
a.txt has content .. abcd
b.txt has content .. 1234

new.txt should have:
abcd
$
1234

Looking for a batch file that would achieve this for an entire directory.

I can successfully create one file with the content of all files with a simple copy command, but do not know how to insert a $ sign between content of each file.

thanks in advance!


See More: Append multiple files, add $ between each one

Report •


#1
June 9, 2009 at 13:15:11
Question already solved one billion times...

:: JOINTXT.BAT Usage: jointxt Folder_Name
@echo off > output.new
pushd %*
for %%j in (*.txt) do (
  type "%%j"
  echo.$
) >> output.new
ren output.new output.txt
popd
:: End_Of_Batch


Report •

#2
June 22, 2009 at 11:18:14
thanks for this post.. Problem is that after appending $, there is a line break. I want to insert a $ sign as per this example:

file1 = abc
file2 = xyz

output.new = abc$xyz

current suggesttion creates output.new =
abc
$
xyz


Report •

#3
June 22, 2009 at 12:32:22
"current suggesttion creates output.new =
abc
$
xyz"

Yep, which is exactly what you asked for.


=====================================
If at first you don't succeed, you're about average.

M2


Report •

Related Solutions

#4
July 9, 2009 at 06:49:44
Here's what I am looking for:

abc$xyz

where abc = file1, $ = delimeter, xyz=file2

Please note, previous suggestions resulted in a linebreak before / after the delimeter. I am looking for an output with No line break. Thanks!



Report •


Ask Question