Copying Files to Output Folder with Date-Time Stamp

Hello UiPath community,

I have a scenario where I need to automate the copying of files from an input folder to an output folder, while also creating a new folder inside the output folder with a date-time stamp. Here’s a breakdown of what I’m trying to achieve:

  1. I have an “Input” folder containing an Excel file.
  2. In the “Output” folder, I have created a new subfolder named with the current date and time (date-time stamp).
  3. The Excel file from the “Input” folder should then be copied to the newly created subfolder inside the “Output” folder with date time stamp.

The goal is to automate this process so that every time the automation runs, the Excel file is copied to a new subfolder within the “Output” folder, and the subfolder and excel file in it is named with the date and time of the copy operation.

Could anyone please guide me on how to achieve this using UiPath?

Thank you for your assistance!

Best regards,
PvS

@lalitapvs You can try something like this:

  1. Use an Assign activity to store the location of the Excel file in the Input folder. Call it strInputFileLocation.
  2. Use an Assign activity to store the timestamp.
strTimeStamp = System.DateTime.Now.ToString("yyyy-MM-dd-hh-mm-ss") 
  1. Create the destination folder string by concatenating the Output folder with the timestamp. Use Assign activity.
strOutputFolderTarget = strOutputFolder + "\" + strTimeStamp 
  1. Create the actual destination folder with the Create Folder activity.
    image

  2. Move the file with the Move File activity:
    image

I have attached a sample Workflow you can try:

MoveFileToOutputTimestampFolder.zip (2,6 KB)

Please let me know if it works for you! :slight_smile:

1 Like

@lalitapvs

hi but when you make the subfolder name with date and time ,during the run time the date will not cause any error but the time stamp will cause a error,give you like sub folder does not exists

subfolder name and moving file name should be same

i have a seen this scenario earlier

cheers

2 Likes