Skip to main content

Recursively Change Mode (sys.lchmod_r)

Declaration

sys.lchmod_r(path, mode)

Parameters

  • path
    String.
  • mode
    Integer. Permission bits, e.g. octal o0755 = 7 * 8^2 | 5 * 8^1 | 5.
    String. Permission text, e.g. "0755" or "rwxr-xr-x" (supported since 2025-06-25).

Description

Recursively change mode for all files and subdirectories. Does not traverse deep directories pointed to by symlinks.
Available in versions after 2025-02-20.

Examples

sys.lchmod_r("/var/mobile/Media/1ferver", 7 * 8^2 | 5 * 8^1 | 5)

-- Since 2025-06-25 the following forms are also supported
sys.lchmod_r("/var/mobile/Media/1ferver", "0755")
sys.lchmod_r("/var/mobile/Media/1ferver", "rwxr-xr-x")