Find latest modified file in a single directory

for every one hour a log file will be created in a folder,need to pick up latest created log file

Hi @ndivya

In Manage Packages search for file and install the package like in the picture below:

After this you will have another package called UiPathTeam inside the activities panel, just expand it and you will find the activity you’re looking for, using it is very easy, just place your path in it a leave the FilePattern to “*” and you should be good to go :

Regards,
Reda

2 Likes

Hi @ndivya
Alternatively, you can check the solution from the below thread:

Hey @ndivya

Here is a detailed article on that :slight_smile:

1 Like

Dear Sharathraju

and if I would like to copy file last time from this activity how to do that? please advise me

Hi @Naruemon
did u mean creationtime?

@NIVED_NAMBIAR I mean after create activity : directory.GetFiles().OrderByDescending(Function(file) file.LastWriteTime).First()
and I want to copy file last time to new folder

copy only file last time

Below expression will give the file location that you are looking for
directory.GetFiles().OrderByDescending(Function(file) file.LastWriteTime).Last()

Thanks,
Poorna M

I am sorry to make you confused @NIVED_NAMBIAR @poorna_nayak07
I will ask a new question.

****If i would like to save file only last date modify to new folder . how to do that?

#Thanks for considering my request.

Use Move File Activity for moving file.
While using this activity put above expression in From property.

Thanks