Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Sorry for brainlock. I have a file created by sql server which is comma delimited. I would like to add a record/line at the end that simply say ##end##. I thought you could concatenate 2 files with a DOS command. Say the data file is called my.dat
and a one line file with the ##end## is called end.dat. Can't you just add the end.dat to my.dat

You can concatenate files in DOS as follows:
copy f1.txt + f2.txt + f3.txt fn.txt, which would add f2 and then f3 to f1 and make a new file fn; however, I think this only works for text files.

COPY
Copies one or more files to the location you specify.
This command can also be used to combine files. When more than one file is
copied, MS-DOS displays each filename as the file is copied.Syntax
COPY [/Y|/-Y] [/A|/B] source [/A|/B] [+ source [/A|/B] [+
...]][destination [/A|/B]] [/V]Parameters
source
Specifies the location and name of a file or set of files from which you
want to copy. Source can consist of a drive letter and colon, a
directory name, a filename, or a combination.destination
Specifies the location and name of a file or set of files to which you
want to copy. Destination can consist of a drive letter and colon, a
directory name, a filename, or a combination.Switches
/Y
Indicates that you want COPY to replace existing file(s) without
prompting you for confirmation. By default, if you specify an existing
file as the destination file, COPY will ask you if you want to overwrite
the existing file. (Previous versions of MS-DOS would simply replace the
existing file.) If the COPY command is part of a batch file, COPY will
behave as in previous versions. Specifying this switch overrides all
defaults and the current setting of the COPYCMD environment variable./-Y
Indicates that you want COPY to prompt you for confirmation when
replacing an existing file. Specifying this switch overrides all
defaults and the current setting of the COPYCMD environment variable./A
Indicates an ASCII text file. When the /A switch precedes the list of
filenames on the command line, it applies to all files whose names
follow the /A switch, until COPY encounters a /B switch, in which case
the /B switch applies to the file whose name precedes the /B switch.When the /A switch follows a filename, it applies to the file whose name
precedes the /A switch and to all files whose names follow the /A
switch, until COPY encounters a /B switch, in which case the /B switch
applies to the file whose name precedes the /B switch.An ASCII text file can use an end-of-file character (CTRL+Z) to indicate
the end of the file. When combining files, COPY treats files as ASCII
text files by default./B
Indicates a binary file. When the /B switch precedes the list of
filenames on the command line, it applies to all files whose names
follow the /B switch, until COPY encounters an /A switch, in which case
the /A switch applies to the file whose name precedes the /A switch.When the /B switch follows a filename, it applies to the file whose name
precedes the /B switch and to all files whose names follow the /B
switch, until COPY encounters an /A switch, in which case the /A switch
applies to the file whose name precedes the /A switch.The /B switch specifies that the command interpreter is to read the
number of bytes specified by the file size in the directory. The /B
switch is the default value for COPY unless COPY is combining files./V
Verifies that new files are written correctly.Related Command
For information about copying directories and subdirectories, see the
command.EXAMPLES
To copy several files into one file, list any number of files as source
parameters on the COPY command line. Separate filenames with a plus sign (+)
and specify a filename for the resulting combined file, as the following
example shows:copy mar89.rpt + apr89.rpt + may89.rpt report
This command combines the files named MAR89.RPT, APR89.RPT, and MAY89.RPT
from the current drive and directory and places them in a file named REPORT
in the current directory on the current drive. When files are combined, the
destination file is created with the current date and time. If you omit
destination, MS-DOS combines the files and stores them under the name of the
first specified file. For example, if a file named REPORT already exists,
you can use the following command to combine all four files in REPORT:copy report + mar89.rpt + apr89.rpt + may89.rpt
If you want to combine several binary files into one by using wildcards,
include the /B switch, as the following example shows:copy /b *.exe combin.exe
This prevents MS-DOS from treating CTRL+Z as an end-of-file character.
CAUTION: If you combine binary files, the resulting file might not be
usable due to internal formatting.

Hi
you can also concatenate files using the copy command like this
copy File1+Flie2 NewFile
echo ##end## >>Newfile

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |