I am using ApacheCommons to connect to a server and get information of a specific file. I am looking for a method like FTPFile file = ftpclient.getFile(path);
or something like this, so I can give it the path of the file and then be able to get info about that file. By info I mean file.getName()
or file.lendth()
.
The only way I found is using listing methods such as listFiles(path)
but it requires using for-loop
and so on. But is there any better way or more straight forward?
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
Use the
FTPClient.mlistFile
:Of course, this will work only, if your server supports the modern
MLST
command.If not, you would have to use a dedicated command for each file property. Like the
SIZE
for file size (not supported natively by Apache Commons) or theMDTM
for file modification time (theFTPClient.getModificationTime
).