Getting file extension

Hello, I have a foler saved in my variable.

I need to use get file info activity to know the extension of the file.

The folder ALWAYS contains 1 file however I don’t know the file name.

What do I type here?

folderdownloads = my variable with directory to downloads folder and then I would like to add “any file” (As there will be always one)) but I don’t know how. Help

image

Hi

Use this expression in a assign activity like this

Str_fileextension = Path.GetFileExtension(Directory.GetFiles(“your folderpath”)(0).ToString).ToString

Cheers @JennZabba

Thanks

I actually came up with a solution the second I posted it,

I did:

image

it works

Hi @JennZabba ,
path.getextension(your file path)

Note that what you’ve done here will only pop up a message box for the extension of the last file in the folder, because the Message Box activity is outside the loop.

yes yes this is what I needed, I know that there always will be only 1 file in this folder so thats fine

Then you don’t need For Each File in Folder. Just assign this to your rozszezenie variable:

New System.IO.DirectoryInfo(In_Primary_Location).GetFiles(“*”)(0)

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