[ftputil] Issue with Hidden Directories

Alexander Michael lxander.m at gmail.com
Fri Oct 21 15:49:25 CEST 2005


On 10/20/05, Stefan Schwarzer <sschwarzer at sschwarzer.net> wrote:
>
> > filenames = host.listdir('')
>
> As with os.listdir, you should pass in "." (=FTPHost.curdir) for the
> current directory.


Thanks for the clarification. That was the first thing I tried, but I
changed while trying to understand why it was failing and forgot to change
it back. It might be nice if the argument to listdir had a default value of
".".

I think your assumption is right, and as far as I see your change should
> work though it seems a bit obscure. ;-) Let me think about if I put in
> the next release. I think that's ok for you, considering the license,
> isn't it?


I'm good to go, just feeding back. In a similar vein, I also found the
following method of FTPHost (actually a class I derived from it where I am
isolating my changes) to be useful:

def is_remote_newer(self, remote, local):
"""
If remote is newer than local, return `True`, else return
`False`.
"""
return self.__copy_file_if_newer(remote, local, '',
self.path.getmtime, self.__shifted_local_mtime,
os.path.exists, lambda x,y,z: None)

I wasn't sure if there was another way to perform the same arithmetic that
occurs in download_if_newer/upload_if_newer without actually
download/uploading the file. In my script, the download takes a while so I
want to notify the user before it starts so the user knows what's taking so
long.

Thanks again,
Alex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://codespeak.net/pipermail/ftputil/attachments/20051021/57bf8811/attachment.htm


More information about the ftputil mailing list