IPWorks SFTP 2020 Python Edition

Questions / Feedback?

on_dir_list Event

Fired when a directory entry is received.

Syntax

class SFTPDirListEventParams(object):
  @property
  def dir_entry() -> str: ...
  @property
  def file_name() -> str: ...
  @property
  def is_dir() -> bool: ...
  @property
  def file_size() -> int: ...
  @property
  def file_time() -> str: ...
  @property
  def is_symlink() -> bool: ...

# In class SFTP:
@property
def on_dir_list() -> Callable[[SFTPDirListEventParams], None]: ...
@on_dir_list.setter
def on_dir_list(event_hook: Callable[[SFTPDirListEventParams], None]) -> None: ...

Remarks

The on_dir_list events are fired when a directory listing is received as a response to a list_directory.

The on_start_transfer and on_end_transfer events mark the beginning and end of the event stream.

The DirEntry parameter contains the filename when list_directory is called.

The class tries to fill out the FileName, IsDir, FileSize, and FileTime parameters when calling the list_directory method.

The format of the FileTime parameter returned by the class can be controlled through the FileTimeFormat configuration setting. If no format is specified, the class will format the date dependent on the year. If the filetime is in the same year, it will be formatted as "MMM dd HH:mm", otherwise it will be formatted as "MMM dd yyyy".

IsSymlink indicates whether the entry is a symbolic link. When the entry is a symbolic link the value of IsDir will always be False since this information is not returned in the directory listing. To inspect a symlink to determine if it is a link to a file or folder set remote_file and query the file_is_dir property.

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks SFTP 2020 Python Edition - Version 20.0 [Build 8263]