How to copy files from folder with changing paths

studio

#1

Hello,

This question ha probably been asked before, but anyway.
I am working on a workflow and i am stuck at the point where i need to copy files from one folder to another.
The problem here is the path look like: C:\Users\Public\Documents*PastMeetingDate*\doc.xls.
The PastMeeting Date is user inputed variable.
The files need to be copied to: C:\Users\Public\Documents*NextMeetingDate*\doc.xls.
The NextMeetingDate is also a user inputed variable.

I have tried the copy file function, like " C:\Users\Public\Documents"&PastMeetingDate&"\doc.xls"
does not work because it cannot concatenate the path.

I appreciate any tips that i can try.


#2

Hello @lalauraa,

could you please tell us that what will be “PastMeetingDate and NextMeetingDate

Sincerely,
Pankaj


#3

Hi @lalauraa

Could it be because you are missing a “\” after Documents in your file path?


#4

Hi @lalauraa,
Here i have attached the sample for your situation.

File : copy files from folder with changing paths.zip (20.1 KB)

Regards
Balamurugan


#5

@lalauraa,You need to navigate to a folder based on date (or) Append date to documents


#6

@pankaj.patil thanks for answering.
“PastMeetingDate” and “Next Meeting date” are 2 variables declared as string. These will be dependent on what the end user will input. Later in the workflow will be used to create a new folder based on the past meeting date with the new meeting date.
Hope this clarifies


#7

Fair point @tmays put in the actual sequence in UiPath i have added the “”.


#8

Just checking. :slight_smile:

So I completely understand, are all of the following are true?

  • The folder “PastMeetingDate” already exists.
  • The user inputs the “PastMeetingDate” - you would have to verify they input correct format as the folder and that the folder exists (assuming above is true)
  • The user inputs the “NextMeetingDate” for a future folder
  • You want to copy ALL files from “PastMeetingDate” to “NextMeetingDate”

#9

@sreekanth I am not sure i understand?
@balupad14 just to confirm what i understand from the screen shot,

  1. create a new variable that holds the path to the folder on the past meeting. -> question how is the variable be populated? user interaction or i can give: “C:\Users\Public\Documents”&PastMeetingDate&\
  2. check if the folder location exists
  3. then it checks if it has files in the folder
  4. if yes then copy the file -> question is there a condition there?
  5. if not display “file does not exists”
    -> will give it a try tomorrow at work

Thank you all for the feedback.


#10

yes you can give the your folder name. Please check the path that has the proper “” symbol.

Regards
Balamurugan


#11

@tmays yes your understanding is correct. that is what i want to do!


#12

OK thanks for clarification i will give it a try! Keep you posted!


#13

Thanks for helping me understand :slight_smile:

I’ve done this requirement please download below code.

  1. Creates both(past and next meeting date) folders based on input,
  2. File that I don’t know how it comes in past meeting date folder. I created past folder first by running workflow then created a doc.xlsx file.
  3. Copying is done in next meeting folder
    Main.xaml (13.9 KB)
    doc.xlsx (6.0 KB)
    Folders.

I created above folder both contains doc.xlsx file,
any doubt please let us know

Thanks,
Pankaj


#14

Okay @lalauraa. Since you have past meeting folders with (possibly) multiple files, you can do something like this. It…

  • Reads your past meeting folders and allows your user to select one. If there are too many you may want to filter somehow.
  • It then asks for the next meeting date and copies the past meeting folder with files to the next meeting folder.

image

image

It would need some input checking and also check to see if past folder is empty. …or not. It will create an empty folder for new files if you want.

Get Folder Make Folder Copy.xaml (20.9 KB)

Hope this helps.
Troy


#15

@Pankaj.Patil Thanks a lot. i tried it and it works
@tmays that is great also. i will try that one also!

Thank you all for taking your time to help me! This is great!


#16

awesome to hear :slight_smile: @lalauraa