Moving files sounds boring until that one process nukes a folder or your robot decides to play hide and seek with a locked file. This guide walks through a tidy UiPath workflow for file management that is easy to read and hard to break. Expect variables, checks, the Move File activity, and some polite failure handling so your automation does not throw a tantrum in production.
High level first then the nitty gritty. You will set up string variables for source and destination paths, validate folders with Directory.Exists
, use the UiPath Move File activity to perform the transfer, and wrap everything in Try Catch blocks to handle exceptions like System.IO.IOException
. Add logging so you know what happened without having to interrogate your robot like a detective.
sourcePath
and destinationPath
Create clear string variables. For example use sourcePath
and destinationPath
. Prefer full absolute paths to avoid surprises when the robot runs from a different working folder. If you need to build paths use Path.Combine
instead of string concatenation to keep things sane.
Always check folder existence with Directory.Exists(sourcePath)
and Directory.Exists(destinationPath)
before moving a file. That simple check avoids sending the robot on a wild goose file chase.
Drag the Move File activity into your sequence and bind its properties to the variables you created. The activity does the actual file transfer with minimal fuss. If you expect name clashes add logic to handle overwrites first.
For overwriting use a conditional check. If the destination file exists then either skip the move, rename the destination, or remove it with a Delete activity before the move depending on your business rule. Keep the decision explicit so the workflow is predictable.
Wrap file operations in a Try Catch. Catch System.IO.IOException
and other relevant exceptions to handle locked files and IO issues. Use Log Message activities to record what happened and why. Logging saves you from staring at logs wondering why the robot decided to nap.
Example catch actions
Run the workflow with sample files and try edge cases such as missing folders, permission errors, and locked files. Observe the logs and refine checks until behavior matches expectations. Manual testing prevents deploying a tantrum prone robot into production.
Append a timestamp to destination names when duplicates are possible. For example construct a file name with DateTime.Now.ToString("yyyyMMdd_HHmmss")
to keep history and avoid accidental overwrites without complex logic.
sourcePath
and destinationPath
This pattern keeps file management in UiPath reliable and maintainable. It scales from simple one off moves to larger automation chains where robust exception handling and clear logs make your life easier. And yes your robot will still occasionally learn to be dramatic, but this setup gives it far fewer chances to ruin the day.
I know how you can get Azure Certified, Google Cloud Certified and AWS Certified. It's a cool certification exam simulator site called certificationexams.pro. Check it out, and tell them Cameron sent ya!
This is a dedicated watch page for a single video.