s365b.modules.paths

Folder paths: folder names joined with /.

A / inside a folder name (“Projects/2026”) is stored as U+2215 DIVISION SLASH, which looks the same, so a path splits back into the folders it was made of. Restore turns it back into /.

Attributes

Functions

join(prefix, name) → str

Return the path of a folder named name inside prefix.

names(path) → tuple[str, ...]

Return the folder names along a path, as Exchange names them.

file_path(folder, name, extension, taken) → str

A unique path for an item in an archive: its folders, then its name.

Module Contents

s365b.modules.paths.SLASH = '∕'[source]
s365b.modules.paths.join(prefix: str, name: str) → str[source]

Return the path of a folder named name inside prefix.

Parameters:
  • prefix – The parent’s path; empty for a top-level folder.

  • name – The folder’s own name.

Returns:

The path.

s365b.modules.paths.names(path: str) → tuple[str, ...][source]

Return the folder names along a path, as Exchange names them.

Parameters:

path – A path made by join().

Returns:

The names, outermost first; empty parts are skipped.

s365b.modules.paths.file_path(folder: str, name: str, extension: str, taken: set[str]) → str[source]

A unique path for an item in an archive: its folders, then its name.

Names are cut to 80 characters and stripped of what file systems refuse; a name used before gets “ (2)”, “ (3)”… Folder names with a “/” keep it as the lookalike they are stored with.

Parameters:
  • folder – The item’s folder path.

  • name – The item’s name, e.g. a message subject or a file name.

  • extension – File extension, without the dot; empty to keep the extension the name has (a file’s own).

  • taken – Paths used so far (case-insensitively); updated.

Returns:

The path, with / between folders.