I need to create a script, which concatenates multiple text files into one. I know it's simple to use
type *.txt > merged.txt
But the requirement is to "concatenate files from same day into file day_YYYY-DD-MM.txt" I am a Linux user and Windows batch is hell for me. It's Windows XP.
Windows type command works similarly to UNIX' cat.
Example 1: Merge with file names - this will merge file1.csv and file2.csv to create concat.csv:
type file1.csv file2.csv > concat.csv
Example 2: Merge files with wildcards - this will merge all files with the .csv extension and create concat_csv.txt.
When using wildcards (* or ?) to iterate all files please DON'T use the same extension for the target file (f.e. .csv). There should be a difference in the filename, as otherwise the target file will also be considered in the concatenation process:
type *.csv > concat_csv.txt
Alternatively just create the target file in a different folder:
type *.csv > D:\elsewhere\concat.csv