Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

Merge text files, and split them later


  • Please log in to reply
No replies to this topic

#1 leuce

leuce

    Universalist

  • Active Members
  • PipPipPipPipPip
  • 277 posts

Posted 08 August 2007 - 11:12 AM

G'day everyone

I'm a translator and I have some less computer literate colleagues. On one of the translation projects, we have a tree with many subdirectories of many levels, with files in them to translate. Opening each file one at a time is time-consuming, especially since many files contain only a line or two to translate.

I want to write a script that will take all files in the tree, and merge them into a single file, with "headers" above each file to identify the path of that file, so that I can later run another script to split the single file back into seperate files in the original tree format.

Please help me think of strategies here.

1. I can read each file and write it to the single file using FileWriteLine, but I suspect that is going to take a long, long time, and the file won't get saved until the very end.

2. I was hoping that it is possible to use a DOS command to merge files (once I have the path of each file), so if anyone knows how to merge UTF-8 files in MS DOS with (important!) the UTF-8 intact (not converted to ANSI/ASCII), please let me know. I'm using Windows XP.

3. I could use two instances of Notepad, and copy from the one and paste to the other. Not elegant, but possibly simple to do. It'll be difficult to use Notepad for splitting, though, because Notepad can't do regex find/replace.

Any other ideas? Or... do you perhaps know of a freeware tool that does this already?

Thanks!
Samuel










0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users