Path Checks-If Decision

Hi Aksh,

I would like to check the latest/newest file inside the folder/directory.
Am i creating the correct sequence? :neutral_face:

Thanks

Hi Aksh,

i would like to follow up on prev. matters.
I want to check/trace the latest file inside the folder and i have created the sequence as above.However the sequence prompted an error.
Could you advise how to know what kind of error and how to solve it?
I hope the created sequence is correct if not could you give some inputs ?

Thanks in advance.

Hey @azmee_zainol

you can refer this existing thread for the same: - Sort file and store attributes - #2 by aksh1yadav

Regards…!!
Aksh

Hi Loginerror,
On your previous feedback, you have asked me whether i’m trying to access the folder literally called YYYYMMDD or does it have an actual date int the name, actually yes there is an actual date in the folder name.
So i cannot using the same method for date variable?

Thanks

@azmee_zainol

This is not a problem, you just have to construct your string with a data part as an actual variable, like this:
"C:\ITPNrpa\"+dataVariable

As to how to construct the date in the correct string format, you can see the forum for plenty of examples :slight_smile:

Hi Loginerror
,

I have some problem here,
I want to create sequence for Latest/Newest file. but the error appear.
I’m not sure how to solve it,
I have attached the file for your reference.

Thanks in advance.Today Newest File.xaml (3.0 KB)

Hi @azmee_zainol

The file you attached is empty.

Also, just to clarify what do you mean by “latest file”. Is it:

  1. the file with the most recent date in the file name
  2. the file that was most recently modified/created
    ?

Hi @loginerror

Sorry for that.
Reattached the file.
Today Newest File.xaml (9.1 KB)

For the term “latest file”, it is the file with the most recent date/time in the folder.
Example in folder ABC there have few files:
efgh, jklm, pqrs, and uvwx.
The latest/newest file that has been created and saved in folder ABC is uvwx.So I want to choose that file to be opened or selected for the next process.
Hope this clarifies,

Thanks in advance.

Hi,
What does this error mean?
image
Is it due to the incorrect variable type?

Variable which u are using it’s having null value

Hi @indra
Thanks for the response.
In that case what variable type should be used? Or what kind of elements we should consider?
I’m not sure how to select most accurate variable.
As per above 2 updates from me i have attached the xml file for reference.

Much appreciated if you can help on this.

thanks

Hi @loginerror,

Could you able to help me ?I have reattached the xaml file for your reference.
Error message has been attached too.

Thank you in advance.

Hi @azmee_zainol

Your file works for me with one small modification:
Newest_File_Check should be an array of System.IO.FileInfo, so System.IO.FileInfo.

See attached workflow, I only modified this one small thing and it worked for me:
image

Today Newest File_corrected.xaml (9.3 KB)

Hi @loginerror,

I have edited and tried as per yr attachment but the error persist as below.

Then , i have changed the Type for Newest_File_Check Variable Type to System.IO.FileInfo but then appear validation error. (attached the axml file.)Today Newest File.xaml (9.3 KB)

Please download and launch my xaml file from previous post. It’s a working solution:)

Hi @loginerror,

Yes, i have downloaded and lunch yr xaml file and compared with mine.
The different is on Variable.
I have changed the variable type from IENumerable to FileInfo as per your xaml.
Prompted the validation error/warning .

Please advise :slight_smile:

Hi again @azmee_zainol

See here:

You need to select an array of the System.IO.Fileinfo elements, thus it needs two brackets at the end :slight_smile:

To do that, you just need to click the Array of [T] first and then specify your element as “System.IO.Fileinfo”

1 Like

Hi @loginerror,
Yes I noticed that unfortunately on my Uipath only have FileInfo without .
image.
If typing till there will have no variable type shown.
image

How to add the variable type as System.IO.FileInfo****

Thanks in advance.

It actually really easy. Follow these steps:

  1. Click on the Array of [T]:
    image
  2. Select the element type of the array:
    image
  3. Click OK and you are done :slight_smile:
1 Like

Hi @loginerror ,

:smile:

Okey I have found it,thanks :sweat_smile:

After changed to FileInfo and tried run the sequence prompted workflow exception .

.

Is it mean there’s something to do with the file?

Please advise.