I have a folder that is filled with sub folders of past dates (20120601 for example), inside each date folder there is a file named test.txt, along with another file named example.txt. How can I merge all the test.txt files into one?
I am trying to do this in Windows and have access to Windows PowerShell and Windows Command Processor (cmd.exe). What would be the best way to do this?
My hierarchy would look something like this:
\Data
\20120601
test.txt
example.txt
\20120602
test.txt
example.txt
\20120603
test.txt
example.txt
\20120604
test.txt
example.txt
\20120605
test.txt
example.txt
I would imagine it is something like
copy *\test.txt alltestfiles.txt
Is that possible? Can you specify a wildcard for a directory?
Fairly easy, actually:
or shorter:
This will first gather all
test.txtfiles, then read their contents and finalle write out the combined contents into the new file.