рд╕рднреА рдЯреЗрдореНрдкрд▓реЗрдЯ
Text ManipulationIntermediate
Concatenate Text Files
RobomotionтАврдкрд┐рдЫрд▓рд╛ рд╡рд░реНрд╖ рдЕрдкрдбреЗрдЯ рдХрд┐рдпрд╛ рдЧрдпрд╛

рдУрд╡рд░рд╡реНрдпреВ
Reads every .txt file in a directory and stitches their contents into a single output file. Useful for log rollups.
Concatenate Text Files
Reading data from multiple sources and consolidating it in a single file is standard in most document-related operations. Robomotion lets you automate these tasks and effortlessly transfer information across numerous documents.
What Concatenate Text Files can do
- Build paths (
Core.Programming.Function) тАФ setsmsg.fixtures_dirunder$Home$/templates/.../fixturesandmsg.output_file_pathtofixtures/ConcatenatedFiles.txt. - Intro dialog (
Core.Dialog.MessageBox,info) titledDescriptionexplaining that the flow stitches multiple text files into one. - Seed list (
Core.Programming.Function) тЖТmsg.files_to_concatenate = [fixtures/part1.txt, fixtures/part2.txt]. - Clean previous output (
Core.FileSystem.Delete,continueOnError: true) againstmsg.output_file_path, thenCore.Flow.GoTointoLoop Start. - Iterate (
Core.Programming.ForEach) overmsg.files_to_concatenateтЖТmsg.current_file,msg.current_index. - Read (
Core.FileSystem.ReadFile,optBase64: false) frommsg.current_fileтЖТmsg.current_file_contents. - Build output (
Core.Programming.Function) тАФ derivesmsg.output_pathas<dirname of current_file>\\ConcatenatedFiles.txtand setsmsg.line_to_write = msg.current_file_contents + '\n'. - Append (
Core.FileSystem.WriteFile,optMode: append,optBase64: false) tomsg.output_path, thenCore.Flow.GoToback toLoop Start. - Completion dialog (
Core.Dialog.MessageBox,info) titledExample completed!once the iterator exits, thenCore.Flow.Stop.
Behind the scenes
- The output file lives in the directory of each source file тАФ if the selected files come from multiple directories, each directory gets its own
ConcatenatedFiles.txt. This is intentional to match the ported behaviour. Core.FileSystem.WriteFileinappendmode is called once per source file, so a pre-existingConcatenatedFiles.txtis deleted up front to guarantee a clean start.- Each file's contents are suffixed with
\nbefore being appended so boundaries remain visible even when source files don't end with a newline. - The completion dialog sits on the iterator's exit edge, so it runs once after every file has been processed.
Text Manipulation рдХреЗ рдФрд░ рдЯреЗрдореНрдкрд▓реЗрдЯ
рд╕рднреА 5 рджреЗрдЦреЗрдВ тЖТ- Count Lines of a Text FileOpens a text file and reports the number of lines it contains. A tiny helper you can drop into larger analytics flows.
- Extract Phone Numbers and EmailsScans free-form text with regular expressions and pulls out every phone number and email address. Foundation for contact-harvesting jobs.
- Get Position of SubtextFinds the character index of a substring inside a larger string. A concise demo of the text-search primitives.
- Sort Lines of a Text FileReads a text file, sorts its lines alphabetically, and writes the result back out. Reusable for cleaning up exports and datasets.