It would be very nice to have an example for walk():
https://ftputil.sschwarzer.net/trac/wiki/Documentation#ftphost-walk
Background: I am not sure how to join the remote path segments. Can I just use os.path.join()? I am not sure if this works if local client is linux and remote is windows (or vice versa).
Sorry, somehow I missed this ticket.
I think this shouldn't be handled as a question regarding
FTPHost.walk
since that concrete method is only one example of the confusion. :-)ftputil is supposed to work the same like the
os
module if you replaceos
with theFTPHost
instance. Useos
for operations on the local file system and theFTPHost
instance for operations on the remote file system.So to join paths intended for operations on the FTP server, you'd use
ftp_host.path.join
, whereftp_host
is anFTPHost
instance:dir = "/some/remote/dir" file = "some_file.txt" joined_path = ftp_host.path.join(dir, file)
Replying to schwa:
ftputil is supposed to work the same like the
os
module if you replaceos
with theFTPHost
instance. Useos
for operations on the local file system and theFTPHost
instance for operations on the remote file system.I've added an example to the "ftputil features" section with commit fd53db64040d9c2e2dcfeb533d71d934120f1e0f.