Search code examples
pythonftpftplib

Querying/parsing file contents on FTP server in Python


I have an FTP server that stores a very heavy text file (over 250G) and I need to run some queries on it ie. parse it and extract some specific data. Is there a way in python to interact with it without the need to download it all? I am aware of ftplib package but couldn't find get it to work for this specific task. I guess what I would like to do is: connect to FTP server, open a text file, run the queries, save the output of the queries, close the file and disconnect from FTP.

PS. I checked the forum for a possible duplicate but couldn't find anything that could answer my question. However, apologies if it's been asked before.

Many thanks


Solution

  • This is not a question about the Python nor the library you are using.

    In general, FTP protocol cannot be used for such operations.

    So if you do not have any other way to access the server (like an SSH shell access) or if the FTP server do not have any very special and rare proprietary capabilities, you cannot do it.