It is probably going in a loop, recursively concatenating all files including the result to the result file (with the glob wildcard).
You can add an extension in the glob, temporarily save it as another extension and move it to the correct one. (As suggested in: https://stackoverflow.com/a/53079166/12657997)
E.g. when you have 3 files:
- a.txt with
a inside
- b.txt with
b inside
- c.txt with
c inside
cat *.txt > res.csv ; mv res.csv res.txt
cat .\res.txt
a
b
c
Edit
This cat command (as shown above), in combination with the output redirect > will increase the result text file as @mklement0 points out.
According to the documentation (https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/get-content?view=powershell-7.1):
-Encoding
Specifies the type of encoding for the target file. The default value is utf8NoBOM.
However the encoding with the output redirect changes the ecoding, as explained in this post: https://stackoverflow.com/a/40098904/12657997
To illustrate this I've converted the a.txt, b.txt and c.txt to zip files (now they are in a binary format).
cat -Encoding Byte *.zip > res.csv ; mv res.csv res2.txt
cat -Raw *.zip > res.csv ; mv res.csv res3.txt
ls .
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 15/03/2021 21:29 109 a.zip
-a---- 15/03/2021 21:29 109 b.zip
-a---- 15/03/2021 21:29 109 c.zip
-a---- 15/03/2021 21:39 2282 res2.txt
-a---- 15/03/2021 21:41 668 res3.txt
We can see that the output size doubles in size for res3.txt (for every utf-8 byte read utf-16 will output 2.
The -Encoding Byte output, in combination with the output redirect, will make it even worse.