Extending Python's os.walk function on FTP server

后端 未结 4 1442
[愿得一人]
[愿得一人] 2021-02-15 15:01

How can I make os.walk traverse the directory tree of an FTP database (located on a remote server)? The way the code is structured now is (comments provided):

4条回答
  •  庸人自扰
    2021-02-15 15:36

    Im going to assume this is what you want ... although really I have no idea

    ssh = paramiko.SSHClient()
    ssh.connect(server, username=username, password=password)
    ssh_stdin, ssh_stdout, ssh_stderr = ssh.exec_command("locate my_file.txt")
    print ssh_stdout
    

    this will require the remote server to have the mlocate package `sudo apt-get install mlocate;sudo updatedb();

提交回复
热议问题