V
V
vitya_brodov2021-09-15 14:10:40
FTP
vitya_brodov, 2021-09-15 14:10:40

How to get latest file via ftp?

Task: Select the latest file from the FTP server and send it by email;
The question is how can this be implemented/designed?

I have implemented functionality in java(Spring):
1. Connect to the server and get the file (without sorting, but simply by specifying the path -> file name)
2. Sending email

Ps I will be glad if you share any links on this topic.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Orkhan Hasanli, 2021-09-16
@vitya_brodov

Good afternoon

get the file (without sorting, but simply by specifying the path -> file name)

What is wrong with sorting?
Here, the answer to your question using Comparator
https://stackoverflow.com/questions/3824983/get-la...
https://stackoverflow.com/questions/30883025/how-t...
PS As an option, you can try get a list of files and the last modified date of each one. Then for each LocalDateTime using the isAfter() isBefore() methods to find the last entry.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question