IPWorks Cloud 2020 Python Edition

Questions / Feedback?

delimiter Property

The delimiter string to use when listing files.

Syntax

def get_delimiter() -> str: ...
def set_delimiter(value: str) -> None: ...

delimiter = property(get_delimiter, set_delimiter)

Default Value

""

Remarks

If this property is non-empty when list_files or list_file_versions is called, any items whose names contain the same string between the specified prefix and the first occurrence of the specified delimiter that follow will be rolled up into a virtual "folder" element, which is returned in place of the individual files themselves.

If a particular item is a "folder" instead of an actual file or file version, then the file_kind property will be set to folder. The same is also true of the on_file_list event's Kind parameter.

File Hierarchy Traversal

By using the delimiter and prefix properties in tandem, applications can effectively "traverse" a virtual hierarchy of files (or file versions) as if it were a filesystem. For example, assume that files with the following names exist within a bucket:

  • MyCompany
  • MyCompany/Department1
  • MyCompany/Department2
  • MyCompany/Department2/EmployeeA
  • MyCompany/Department2/EmployeeB

With delimiter set to /, we can set prefix to successively "deeper" values before calling list_files or list_file_versions for the following effect:

prefix Value Files Returned Folders Returned
(empty) MyCompany MyCompany/
MyCompany/ MyCompany/Department1
MyCompany/Department2
MyCompany/Department2/
MyCompany/Department2/ MyCompany/Department2/EmployeeA
MyCompany/Department2/EmployeeB
(none)

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