I want to download latest file from FTP folder

Hi, I want to download a latest file from the FTP folder, it’s name is changing on daily basis but file first name is same (e.a. file name is XYZ_16_08_2021_085841, so XYZ is same on daily basis)

I wish to download the file base on latest uploaded file and if there is no upload then it won’t download. (it won’t download the yesterdays file or the file in which we have already worked on)

1 Like

Hey,
Unfortunately, UiPath actions don’t provide such this possibility. You have to download the files to some temporary folder first and then check if the filename meets your condition.

:grinning_face_with_smiling_eyes::grinning_face_with_smiling_eyes::grinning_face_with_smiling_eyes: :+1::+1::+1:

Hi @Supreethragavendra

I am not sure but you can give it a try and let me know if it works.

Use the download activity of FTP package and try to place the following code in remote path
Directory.GetFiles(yourfolder_path,"*.txt").OrderByDescending(Function(d) New FileInfo(d).CreationTime).Tolist(0)
where youfolder_path is your remote location.

Thanks,
Satish
Happy Automation

image
its showing this error

Hi @Dmitri00007

Kindly ensure the above mentioned directory is exist in the system or not.

If not, correct it by passing the right inputs.

Thank you.

I’m downloading the file from FTP server. difficulty is, I’m unable to download the latest file from the folder

Hi @Dmitri00007

Can you try using the below activity to get the files from FTP server?
Please use the below code to get most recent file from a directory.

image

Directory.GetFiles(our_FolderPath,”*”,SearchOption.AllDirectories).OrderByDescending(Function(d) New FileInfo(d).CreationTime).Take(1)

Thank you.

1 Like

yes, I tried its sharepoint activity, showing error when I put the path.
fetching data from filezilla.

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