Add File Names to Text Files
top of page

Add File Names to Text Files


If you're combining a large set of text files together (perhaps with method described in the Litigation Support Tip of the Night for January 15, 2016) it may be helpful to add in the name of the files to the actual text, in order to keep track of where the content text came from.

See this example where we start with text files in which the file names are those of famous writers. See this example, where the content is shown in the preview pane on the right.

Now press CTRL + SHIFT, plus right click in the folder containing the text files you want to analyze, and select 'Open command window here'. At the command prompt enter:

findstr "^" "c:\add file name\*.txt" >output.txt

Then check the source folder with text files you want to analyze and you'll see that a new file has been generated with the paths and file names of the source text files, and their content as well.

Special thanks to those who posted on Stack Overflow here.

bottom of page