Yeo695 Posted March 13, 2013 Posted March 13, 2013 Not related to my post yesterday about a website IM program, Currently I'm using IPswitch IM system at one of my school districts for teacher to teacher chat hosted on a local server and i'm pulling at least 10,000 IM chat logs in every other month in .rtf format . I've been able to combine them all by changing them to .txt files using (RTFtoUTXT) a free program used for changing mass amounts of .rtf files to .txt files. Then I proceed to use a program called simple file joined (SFJ) that joins all my logs together. But SFJ seems to be bugged and designed by a young child who was banging on a keyboard. Sometimes it will insert dividers written in Chinese text, other times it will put a bunch of script and file locations. When it does work though it puts triple spaces between all the charecters in a text document like "h e l l o". What I'm trying to get to Is does anyone know of a good program to combine .log, .rtf or .txt files without any issues and simple dividers? (To put things in perspective when finished i had about 2.4 millions words and 6,203 thousand pages on word with Calibri 10) Thanks
Valyyn Posted March 14, 2013 Posted March 14, 2013 I used this one years ago: Text file merging tool - TXTcollector, freeware! which I remember being pretty good, and does more than just .txt files Otherwise, you could probably get away with a .bat file, something like: for %f in (*.txt) do type %f >> combined.txt
Yeo695 Posted March 14, 2013 Author Posted March 14, 2013 .bat file would be hard. Wouldn't i have to type out each file name? like... (remember i dealing with 10,000+ files) "name.txt name.txt name.txt >masterfile.txt" And for txt collector I kept getting errors once i compiled them. I would list the title the "could not be written" after each one.
Valyyn Posted March 15, 2013 Posted March 15, 2013 That's a shame - txt collector used to be really good. That code I put in above should iterate through every .txt file in the folder and "type" the contents into the combined.txt file, so you wouldn't need to type out the filenames. (It will do every txt file in that folder though!) I don't think it does line breaks though, so you will probably end up with a bit of: File 1 starts here File 1 contents File 1 ends hereFile 2 starts here File 2 contents File 2 ends hereFile 3 starts here so not 100% ideal :/
Yeo695 Posted March 15, 2013 Author Posted March 15, 2013 I'll keep messing around with it i'm bound to find something
Arthur Posted March 16, 2013 Posted March 16, 2013 does anyone know of a good program to combine .log or .txt files without any issues and simple dividers? PowerShell should do this easily. The two scripts below both do exactly the same thing - the only difference is the second one reads .txt files from every subdirectory within the source folder. Each file will be separated by a blank line in the concatenated text file. $SourcePath = "C:\Source" $Pattern = "*.txt" $OutputFile = "C:\Destination\Combined.txt" [system.IO.Directory]::GetFiles($SourcePath, $Pattern) | ForEach-Object { [system.IO.File]::ReadAllText($_) + [Environment]::NewLine } | Out-File -filepath $OutputFile -Append $SourcePath = "C:\Source" $Pattern = "*.txt" $OutputFile = "C:\Destination\Combined.txt" [system.IO.Directory]::GetFiles($SourcePath, $Pattern, [system.IO.SearchOption]::AllDirectories) | ForEach-Object { [system.IO.File]::ReadAllText($_) + [Environment]::NewLine } | Out-File -filepath $OutputFile -Append Note. Do not save the output file to the source folder, otherwise PowerShell will go into an infinite loop and fill your hard drive up.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now