brasiman
asked on
How to combine txt files and change .txt extension
I have multiple .txt files in one folder. Each .txt file has a few rows of data. How would I create a batch file that will combine the rows on all the text files into one .txt file. So if there are 5 .txt files and 2 rows in each of those text files, the new .txt file would have 10 rows of data. Also, when this new file is created, I need the file extension to be ".tra". The file name can be "TR2016" Is there a way to do this? Thanks!
ASKER
Thank you NVIT! This is perfect! One thing I forgot to ask, what if I want to move the .tra file to a different location? So the .txt files are in c:\folder and i want to create the .tra file in the c:\TRA_Files.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
NVIT, thats perfect. Thank. I just ran into the last thing with this. And if i need to start another question I can. When I run this, the old .txt files are left behind in c:\folder\. Is there a way, keeping the script as is, just adding a way for me to specify a folder that those .txt files are put...and have a folder created with it date and time stamped? So, using what you suggested, but then adding code where I specify where to create a new folder, the title of the folder is the current date and time, then the .txt files are moved to the newly created folder. Does that make sense? Thanks!
Hi brasiman.
Please close this question. I'll help you with the next one. In that one, add a link to this page.
Please close this question. I'll help you with the next one. In that one, add a link to this page.
ASKER
Hi NVIT, I'll close this one now. Here's the link to the new question:
https://www.experts-exchange.com/questions/28972004/How-to-combine-txt-and-create-a-new-folder.html
https://www.experts-exchange.com/questions/28972004/How-to-combine-txt-and-create-a-new-folder.html
ASKER
Perfect! Replied quickly. Thanks!
Make a .bat file of this.
Change FNSrcPatt, and FNOut values per your needs.
Open in new window