Opened 4 years ago

Closed 4 years ago

#92 closed enhancement (fixed)

Docs for walk()

Reported by: ftputiluser Owned by: schwa
Priority: minor Milestone: 3.3
Component: Documentation Version:
Keywords: local paths, remote paths Cc:

Description

It would be very nice to have an example for walk():

http://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).

Change History (3)

comment:1 follow-up: Changed 4 years ago by schwa

  • Keywords local paths remote paths added
  • Milestone set to 3.3
  • Priority changed from major to minor
  • Status changed from new to assigned

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 replace os with the FTPHost instance. Use os for operations on the local file system and the FTPHost 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, where ftp_host is an FTPHost instance:

dir = "/some/remote/dir"
file = "some_file.txt"
joined_path = ftp_host.path.join(dir, file)

comment:2 in reply to: ↑ 1 Changed 4 years ago by schwa

Replying to schwa:

ftputil is supposed to work the same like the os module if you replace os with the FTPHost instance. Use os for operations on the local file system and the FTPHost instance for operations on the remote file system.

I've added an example to the "ftputil features" section with commit [6b49dedd1dcf].

Last edited 4 years ago by schwa (previous) (diff)

comment:3 Changed 4 years ago by schwa

  • Resolution set to fixed
  • Status changed from assigned to closed
Note: See TracTickets for help on using tickets.