Skip to main content

Recursively Change Owner and Mode (sys.lchownmod_r)

Declaration

sys.lchownmod_r(path, uid, gid, mode)

Parameters

  • path
    String.
  • uid
    Integer.
  • gid
    Integer.
  • 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 owner and mode for all files and subdirectories. Does not traverse deep directories pointed to by symlinks.
Available in versions after 2025-02-20.

Examples

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

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