Opened 14 years ago
Closed 9 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 )
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 14 years ago by
Description: | modified (diff) |
---|---|
Resolution: | → wontfix |
Status: | new → closed |
Summary: | add an option to (try to) list hidden files too → Add an option to (try to) list hidden files, too |
Version: | → 2.2.2 |
comment:2 Changed 12 years ago by
Milestone: | → never |
---|
comment:3 Changed 9 years ago by
Milestone: | never → 2.7 |
---|---|
Resolution: | wontfix |
Status: | closed → 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 9 years ago by
Resolution: | → fixed |
---|---|
Status: | reopened → 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.
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. ;-)