Get only .xls file from the folders

I have the tree folder structure, where I have the main folder which is Export and inside it I have 4 folders like Invoice01…, Invoice02…like that.
But inside these folders and I have some file which is in the image and excels format and one folder inside it which contain one excel file. But i want to move this excel file from the folder Invoice01…, Invoice02…like these
Can anyone tell how can I get only excel.
image

Buddy @balkishan

You can get the xlsx files alone from a folder pathby using this
out_file_array = Directory.Getfiles(“YOURFOLDERPATH”,“*.xlsx”)
where out_file_array is of type array

Cheers @balkishan

3 Likes

@Palaniyappan, I have another folder inside this folder
image

But I need only extracted_information. Here is the question is the name of the csv is same in all the folder as extracted_information. So I thing I have to used timestamp right me if I am wrong, or any other method to do this. To collect all the extracted_information file from all the folder I want to save in particular folders.

Buddy sorry i didn’t get you, i mean like which one you want the file extracted_information or you want to open the folder extracted_information and get the files from it

Cheers buddy @balkishan

@Palaniyappan If you see this bro here is the tree structure.
Export is the root folder
where there are 4 folders name Invoice01…, Invoice02… like that

Again if you see inside the folder Invoice01… → extracted_information (Folder)
extracted_information (CSV File)
Invoice01 (Image)

If you see bro, folder Invoice01… containing the three files include the csv right? same three files with same name in all the three folders Invoice02…, Invoice03… & Invoice04.

Now I want to copy the extracted_information csv files from all the folder and save in one folders. Hope you got it :slight_smile:

image

Hello,
Can you try this?
array_directories = Directory.GetDirectories(“yourPath\Export”)
And then use For Each and find the xlsx file in each subdirectory(Invoice0X.tif…) and move this file?

1 Like

Buddy @balkishan

This can help you buddy
https://go.uipath.com/component/directory-subdirectory-file-search#

Cheers

1 Like

@Palaniyappan Thanks will try bro :slight_smile:

1 Like

Kindly try and let know buddy
@balkishan
Cheers

1 Like

@Palaniyappan Bro I’am able to fetch these files, but can you tell me what to put in the Output- FilePath— As I give the folder path where I want to store these files, but it’s not taking. can you tell me where did I mistake
image

If I give the direct path it’s showing me this error

or If press ctrl+k and create a new Variable and set this path in that Variable same error it’s giving me that time. So what exactly we need to set here

1 Like

Change the type buddy to string as list buddy and initiate with default value as
new list (of string)
@balkishan

1 Like

@Palaniyappan same error it’s showing me bro, when I change the type from List to string

1 Like

buddy infolder is of type string i think, kindly change it to list and change the scope in variable panel as well @balkishan

1 Like

Like this bro

Previously I changed to String only.

1 Like

in default value put like
new list(of string)
buddy @balkishan

2 Likes

you want to say like this bro?

NO buddy simply new list(of string) that means list created of string type values
Cheers

2 Likes

Now the error is removed bro, So can you tell me is there any activity to copy/move this file and save in a particular folder.
image

I did like this bro.
image

But giving this error
image

Buddy it would give you list of paths as output with which you can you can get the xlsx file alone.

1 Like