CombinePath Activity
Purpose: This activity combines multiple path segments into a single path. It properly handles path separators and ensures the resulting path is correctly formatted for the operating system. This is useful for building file paths from separate components like directory names and filenames.
Input Properties
The first path segment. This is typically the base directory or root path.
Type: string
Required: Yes
Example: "C:\Data" or "C:"
The second path segment. This is typically a subdirectory or filename.
Type: string
Required: Yes
Example: "Documents" or "File.txt"
The third path segment (optional). Can be used for additional subdirectories or filenames.
Type: string
Required: No
Example: "SubFolder" or "File.txt"
The fourth path segment (optional). Can be used for additional subdirectories or filenames.
Type: string
Required: No
Example: "File.txt"
Output Properties
The combined path from all segments. Empty segments are automatically filtered out.
Type: string
Note: Returns the combined path if successful, an empty string if all path segments are empty, or an error message (starting with "Error: ") if an error occurs.
Usage Example
Scenario: Combine two path segments Configuration: - Path1: "C:\Data" - Path2: "Documents" - Path3: "" (empty) - Path4: "" (empty) Result: - CombinedPath: "C:\Data\Documents" Scenario: Combine multiple path segments Configuration: - Path1: "C:\Data" - Path2: "Documents" - Path3: "Reports" - Path4: "Report.txt" Result: - CombinedPath: "C:\Data\Documents\Reports\Report.txt"
Error Handling
Important: The activity handles errors gracefully:
- If all path segments are null or empty,
CombinedPathwill be an empty string - If the path contains invalid characters (
ArgumentException),CombinedPathwill contain: "Error: Invalid path - {exception message}" - If any other exception occurs,
CombinedPathwill contain: "Error: {exception message}" - The activity does not throw exceptions - errors are indicated in the
CombinedPathoutput
Note: This activity does not require the paths to exist - it only combines path strings.
Important Notes
- This activity does not require the paths to exist - it only combines path strings
- Empty or null path segments are automatically filtered out - you don't need to provide all four segments
- Path separators are automatically handled based on the operating system
- Works with both absolute paths (e.g., "C:\Data") and relative paths (e.g., "Data")
- Use this activity to build file paths from separate components
- Use GetDirectoryName and GetFileName to split paths back into components
Related Activities
- GetDirectoryName - Extract directory from file path
- GetFileName - Extract filename from file path
- GetTempPath - Get temporary directory path