17 March 2009

Concatenating files


Had a problem in Thunderbird recently. For whatever reason, my wife lost all the mails in a specific folder. Thanks to our WD World Edition, everything is backed up, so I closed down Thunderbird and restored an older file, that I thought was the right one: afb-movie.msf. Folk who know Thunderbird are going to be screaming that a folder in Thunderbird is *two* files, not one, so although all the titles were back in her folder, the actual mails weren't. Anyway, I went back to the Restore and found a 74 MB file called afb-movie as well as the 100 KB or so afb-movie.msf. However, there were also new mails, that were there so I needed to join the two mailbox files together. Now the files are just text files, so I could have loaded the 74 MB into my text editor and pasted the new one at the end, but it probably would have taken a while, so instead I used a DOS command like so:

for %f in (*.log) do type "%f" >> aggregate.txt
I changed the (*.log) to (afb-movie*) to get the afb-movie2 and afb-movie2.bak files and join them together into a single file called afb-movie and changed aggregate.txt to afb-movie.

Easy peasy lemon squeezy. (when you Google "concatenate text files Vista" and find this website: http://www.howtogeek.com/howto/keyboard-ninja/keyboard-ninja-concatenate-multiple-text-files-in-windows/)

1 comment:

Mark said...

Oooh, handy! Ta!