Hi,
I want to move an excel file from one folder to another using the move activity so how can I perform this activity as providing the full path including the full name(file name), it is working fine. But the problem is the excel file name keeps on changing. (excel file: abc_01-07-2019, abc_02-07-2019).So, any help would be appreciated
strExcel [ ] = Directory.GetFiles(“FolderPath”,“*.xlsx”)
It will read all Excel files from folder and will give output as String of array. And then use For Each loop to itreate that array and inside use Move File Activity to move it.
But there is only one file in the folder so is it necessary to use arrays
Hi @Ejaz44
Use this assign activity by @lakshman and once you got all the files, you can use the component that I created and published in UiPath Go! that moves files:
https://go.uipath.com/component/move-multiple-files-0c4e0d
You will just pass the strExcel and the folder path where you want it to be moved.
Thank you
Ok. Then use Move File Activity after that above expression.
And pass source as strExcel(0) and specify destination folder.
can we use wildcards in the variables in which the path is stored
My problem is that the program is working properly, it is showing me error when the filename is changing so is there a way that I can change or add a wildcard(*) in the variable which is storing the path and I think after that it will be working fine.
Hi @Ejaz44
Good Morning, If you would like to move the files in a folder called “Invoices” to “InvoiceArchive” based on any rule like filename contains certain keyword or Last Modified Date etc., then you could achieve it using the following approaches.
- Using For each file - Activities - For Each File in Folder
- Using vb.net
strFilePaths[ ] = Directory.GetFiles(“SourceFolderPath”,“*.xlsx”)
Use For Each loop to iterate the array and inside use if activity if you like to do further filtering and then Move File Activity to move it.