Open the command prompt and remind yourself of what DOS looks like, then use the “for” command.
The syntax is simple enough:
for <filename> in (<directory>) do <command> <filename>
Working with our directory full of (*.log / *.txt) files, we use the “type” command and then pass each file into a new file using the >> operator.
">>" Appends data to the end of the file.
">" Completely replaces the file with new contents.
Inconclusion then here’s the command you need to run.
for %f in (*.log) do type “%f” >> NewFile.txt
This assumes you are in the directory containing the log files. If you are appending *.txt files I'd advise you to use NewFile.log. otherwise the command will append the new file to itself when it finds it in the directory !
As always, hope it proves useful.
No comments:
Post a Comment
Please, no purely anonymous comments, they will be deleted; always use a name for ease of reference by other commenters.