Q:

How to merge multiple text in multiple folders with consecutive numbering using batch script?

I have 400 folders (named '1' to '400') containing multiple text files that I'd like to merge into one per folder and number after its folder's name (or at least provide with consecutive numbering in the file names).
I know how to merge files in the terminal using the cat command, but can only do this by hand for each single folder. I guess a batch script should make this a lot easier, but I'm new to batch scripting. Can anybody help me out?
I'm working on a Mac and have Python 2.7.9 installed.

A:

You can do this with bash like this:
for i in {1..400}
do
    cat $i/* > $i/$i
done

