Opened 11 years ago

Closed 7 years ago

#23 closed enhancement (fixed)

Add an option to (try to) list hidden files, too

Reported by: ftputiluser Owned by: schwa
Priority: major Milestone: 2.7
Component: Library Version: 2.2.2
Keywords: hidden files, dir, list Cc:

Description (last modified by schwa)

Info

ftputil version: 2.2.2

python: 2.5.1

ftpserver: any, (i used proftpd on localhost)

OS: Linux julian-laptop 2.6.20-16-generic #2 SMP Thu Jun 7 20:19:32 UTC 2007 i686 GNU/Linux

Problem

Currently hidden files on the remote host are not listed. it would be nice if (maybe as an option to be set by a flag) the ftp DIR command could be called with "-a [path]" instead of "[path]" as an argument.

Currently i have a work around by changing ftputil.py, line 748 from

ftp_error._try_with_oserror(self._session.dir, path, callback)

to

ftp_error._try_with_oserror(self._session.dir, '-a '+path, callback)

I'm not sure how generic this options works across servers with different OS's though.

-- cheers,

julian

Change History (4)

comment:1 Changed 11 years ago by schwa

  • Description modified (diff)
  • Resolution set to wontfix
  • Status changed from new to closed
  • Summary changed from add an option to (try to) list hidden files too to Add an option to (try to) list hidden files, too
  • Version set to 2.2.2

This topic has has been brought up on the mailing list, and because of the problems mentioned there, I tend to refrain from adding the requested support for hidden files.

I set the resolution to "wontfix" but that's not necessarily my final word, but for now, it is. ;-)

comment:2 Changed 10 years ago by schwa

  • Milestone set to never

comment:3 Changed 7 years ago by schwa

  • Milestone changed from never to 2.7
  • Resolution wontfix deleted
  • Status changed from closed to reopened

As this topic has been brought up in ticket #63 again, I reopen the ticket. I plan to implement an auto-probing feature as described in comment 12 of ticket #63.

comment:4 Changed 7 years ago by schwa

  • Resolution set to fixed
  • Status changed from reopened to closed

I have implemented auto-probing of LIST's -a option as of changeset [34fde55180be].

Note a few caveats:

  • All servers I tried seem to ignore LIST options they don't know. So if ftputil finds the option is accepted, that doesn't mean that it'll have any effect.
  • In theory the server might consider the option, but do something different with it than displaying hidden entries.
  • Even if the server software supports the -a option, the server might be configured to ignore it.
  • There may be rare programs which rely on "hidden" entries not being displayed. In that case, please change your code. As a crude workaround, you can use ftp_host._accepts_list_a_option = False right after the login. However, this may stop working some day, so you should really adapt your code.
  • There's an anomaly with directory entries which start with a hyphen. For example, if you try to list a line for a file named "-a", the server will interpret "LIST -a" or even "LIST -a -a" as a LIST for the whole directory. The entry "-a" will be displayed though. However, this shouldn't have any effect if you only use ftputil's official API.
Note: See TracTickets for help on using tickets.