All templates
Desktop AutomationBeginner
Copy Files
Robomotion•Updated 9 months ago

Overview
Copies every file from a source directory into a destination, with optional overwrite. Demonstrates how to enumerate files and drive file-system operations from a subflow.
Copy Files
Creating copies of files and folders is a fundamental ability of the Windows file system. Using the available file and folder nodes, you can automatically copy files and folders and effortlessly perform tasks such as taking backups.
What Copy Files can do
- Seed sources (
Core.Programming.Function) — resolvesmsg.fixtures_dirunder$Home$/templates/.../fixtures, setsmsg.files_to_copyto[source_a.txt, source_b.txt]andmsg.default_desttofixtures/dest. - Input Dialog (
Core.Dialog.InputBox) titledCopy files, messageSelect the folder to copy the file to.., defaultmsg.default_dest→msg.destination_folder. - Branch on cancel (
Core.Programming.Function,outputs: 2) — ifmsg.destination_folderis empty, short-circuit toCore.Flow.Stop; otherwise proceed. - Create destination (
Core.FileSystem.Create,optType: directory,continueOnError: true) againstmsg.destination_folder, thenCore.Flow.GoTointoLoop Start. - Iterate (
Core.Programming.ForEach) overmsg.files_to_copy→msg.current_file,msg.current_index. - Build destination (
Core.Programming.Function) — extracts the basename ofmsg.current_fileand setsmsg.dest_path = msg.destination_folder + '\\' + basename. - Copy (
Core.FileSystem.Copy,continueOnError: true) frommsg.current_filetomsg.dest_path, thenCore.Flow.GoToback toLoop Startuntil the iterator exits and hitsCore.Flow.Stop.
Behind the scenes
continueOnError: trueonCore.FileSystem.Createlets the flow proceed when the destination directory already exists, and onCore.FileSystem.Copyit keeps the loop running if a single file fails to copy.- The loop is driven by a
Core.Flow.Label+Core.Flow.GoTopair wrapped aroundCore.Programming.ForEachso the per-file copy steps live on a separate wire and re-enter the iterator cleanly. - Destination path is built by scanning for the last
/or\\so the flow works with fixtures written using either separator.
More desktop automation templates
See all 11 →- Add Datetime to File NamesRenames every file in a directory by appending the current date to its name. A quick way to version artefacts, snapshots, or export batches.
- Delete Files of Specific Size RangeScans a directory and deletes files whose size falls inside a min/max range. Useful for pruning oversized logs or clearing tiny scratch files.
- Find and Delete Empty FilesWalks a directory, locates zero-byte files, and deletes them in a single pass. Handy for cleaning up broken export folders.
- GUI Testing CalculatorDrives the Windows Calculator through native UI automation to validate arithmetic. A concrete template for end-to-end GUI testing of desktop apps.
- Open a FolderLaunches the system file explorer pointed at a given path. Minimal template demonstrating the Application.Launch node.
- Print Current Week's CalendarGenerates an HTML page for the current week and sends it to the default printer. Useful for team dashboards or physical planning boards.