Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
Bat Prog: Copy 1 txt files into 1?
Name: Zephyrus14 Date: March 22, 2009 at 13:10:54 Pacific OS: Windows XP Subcategory: Batch
Comment:
Hello,
I have a directory, lets call it "C:\Folder". Inside this directory are multiple text files. There could be only 1, but there could be 30 of them, it all depends. These text files are also named different things every time. All I need to do is to copy the contents of each text file into one large text file (lets call it output.txt). I'm completely lost :(. Anyone, please help! Thanks!
Name: IVO Date: March 22, 2009 at 13:42:41 Pacific
Reply:
@echo off pushd C:\Folder for %%j in (*.txt) do type "%%j" >> output.txt popd :: End_Of_Batch
0
Response Number 2
Name: Zephyrus14 Date: March 22, 2009 at 14:03:57 Pacific
Reply:
This works great! Thanks!
But... I need a line break in between each of the entries from the multiple text files in output.txt.
any way to do that too?
0
Response Number 3
Name: IVO Date: March 22, 2009 at 14:21:00 Pacific
Reply:
@echo off pushd C:\Folder for %%j in (*.txt) do ( echo.>> output.txt type "%%j" >> output.new ) ren output.new output.txt popd :: End_Of_Batch
Beware output.txt must not be in the same folder of the source text files.
0
Response Number 4
Name: Zephyrus14 Date: March 22, 2009 at 15:24:04 Pacific
Reply:
IVO,
I've copied and pasted the code you have provided, but this leaves me with an output.txt with four lines with 1 space on each line (four lines because I had 4 txt files in the folder, as a test). So, in other words, it creates the line breakes, but looses the data.
I really appreciate your help, but am I doing something wrong?
0
Response Number 5
Name: IVO Date: March 22, 2009 at 15:45:36 Pacific
Reply:
@echo off pushd C:\Folder for %%j in (*.txt) do ( echo.>> output.new type "%%j" >> output.new ) ren output.new output.txt popd :: End_Of_Batch
Sorry I made a tiny mistake correcting the code as , I repeat, output.txt can't be generated directly into the folder, so I name it .new then rename to .txt when the process ends.
Summary: I'm new to the batch file world and am in desperate help for something I'm sure is very basic. I need to copy a .txt file into the folder that contains my DOS program (called wavgen) and rename it...
Summary: Here's my situation: Computer A controls a medical device which daily generates a report file. Computer A runs DOS 6.22 OS and is for safety reasons not connected to the network. Server B runs Windows...
Summary: Hi All, I requires a .bat script for the below requirement i have two .txt files in a folder A , i want to move any one of these .txt to folder B.If in folder A i have only 1.txt file then i want to c...