Robot to go through all the files and copy filename

Hi, I would like my robot to go through all the files - copy the file names to a variable, enter the application, run on this application and again to the next file, copy the file name and so on until it goes through all the files.

I used For each Directory.GetFiles(“C:\Users\login\Desktop\folder1\folder2”)

and in “for each” - set variable value: variable = Path.GetFileNameWithoutExtension(“C:\login\Desktop\folder1\folder2”) - but it shows me the name of the folder, not the file. The files can have different names, the names are not constant, so how can I make it get the filename without specifying the filename in the code.

Hi @sullivanne

Do you want to get the file names from Folder2.

Regards

Yes, folder in folder :slight_smile:

Hi @sullivanne

Path.GetFileName(CurrentFile.ToString)

1 Like

Hi @sullivanne

For Each item In Directory.GetFiles("C:\Users\login\Desktop\folder1\folder2")
    Assign fileName = Path.GetFileNameWithoutExtension(item)
    // Use the fileName variable in your automation workflow
End For Each

1 Like

Hey @sullivanne
You can use Directory.GetFiles("C:\Users\login\Desktop\folder1\folder2") as array of strings and then in for each activity use assign value = Path.GetFileNameWithoutExtension(item)

1 Like

@sullivanne

Filepath=Directory.GetFiles("C:\Users\rlgandu\Downloads\EmailExtraction")
FileNames=Path.GetFileNameWithoutExtension(currentItem.ToString)


1 Like

Hi @sullivanne

You can try this way:
Sequence12.xaml (10.8 KB)

Hopew it helps!!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.