简体   繁体   中英

Python ftplib: Getting number of files from FTP

Am new to Python and using FTPLib for some reason.

My aim is, am having a server where files with .txt will be stored by different clients very frequently. With nlst() function I could get the files present in the FTP server. But it returns all the files. Since the server has hell lot of files the response time is slow.

Is there any way to get the first twenty elements from the FTP using some function and then next twenty? This way I could improve the response time from FTP server considerably.

Regards

No there's no standard way to retrieve directory listing by parts in FTP protocol.


Some FTP servers do support wildcards in the listing commands ( NLST and alike). So you could get first all file starting with a , then with b , etc. But you have to test this specifically with your server, as it is a non-standard behavior.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM