Problem:

I was facing a situation wherein I had hundreds of files lying around and had to take printout of all the files. Having to take printout of each and every file proved to be nightmare.

Solution:

The solution was to merge all the files into a single file or copy the contents of multiple files into single file.

Before issuing these commands at the command prompt change to the directory where all the files are present. The code shown below copies the contents from all the files ending with .py extension into a new file called mergedFile.doc. The reason I created a word doc file is, it’ll be easier to take printout and had no reason to think otherwise.

copy /b *.py mergedFile.doc

To merge multiple text files into a single document file the command used is given below.

copy /b *.txt mergedFile.doc

To merge multiple text files into a single text file the command used is given below.

copy /b *.txt mergedFile.txt

To merge multiple java files into a single document file the command used is given below.

copy /b *.java mergedFile.doc

Code shown here is tested on Windows 7/8/10 machine.


Comments

comments powered by Disqus