How to use click activity to select a particular file from a folder

Hi All

I am working on a problem wherein i am supposed to attach a file from my local system into the web, the issue is that as a pre-processing step the zip files inside these folders are already named on the date of creation.

The issue i am facing here is that i want to attach today’s file inside the browser.

Screenshot show how the files inside browser looks like, i should attach the 16032021 file.

Thanks

@shekhawat.arjun1307

For uploading did you get a dialog box and path of the file to attach the file? can you show me the box which you select to attach the file

Instead of using GUI to select, you can try with Path exist activity as below

“Pathof the file” + Date.Now.ToString(“ddMMyyyy”)+“.zip”

If that exists then use the TypeInto activity to type the entire path of the file into the FileName if available in the upload box

Hope this helps you

Thanks

@shekhawat.arjun1307

Take the current system date in 16032021 format and pass file path you can attach the file, Currentfolderpath\16032021.zip.

Thanks
Latika

Hi @Srini84

This is what the dialog box and the folder looks like, i already tried typing in the search box of the folder - “Pathof the file” + Date.Now.ToString(“ddMMyyyy”)+“.zip” but it shows no file.

Hi @Latika10011740

I tried this but weirdly when i give Currentfolderpath\16032021.zip, it shows no file

@shekhawat.arjun1307 - you want to get the file created today from the green folder and attach it right ?

If yes then please try the below code…

StrFileName = Path.GetFileName(Directory.GetFiles(YourFolderPath,“*.zip”).OrderByDescending(Function(d) New FileInfo(d).creationtime).First)

StrFileName is String Type.

This code will give you only one filename which created today.

Hi @prasath17

I tried this not working for me.

@shekhawat.arjun1307 - please show the screenshot of the code which you have tried and error …

Hi @Srini84

I have attached the dialog box and the path of the file to attach in the next comment, the issue is still npt resolved. Can you help in this?

Here you go:

Here is my files in the folder…

image

Code:

StrGetTodayFileName = Path.GetFileName(Directory.GetFiles(“Test\ZippedFiles\Green",”*.zip").OrderByDescending(Function(d) New FileInfo(d).LastWriteTime).First)

Here StrGetTodayFileName is of type string…

Hope this helps…

@shekhawat.arjun1307 - Did you get a chance to test the code shared??

hi prashant I test this code its return last date modified date I just need to know what is means of here LastWriteTime & creationtime