Change file permissions

lockpick(path, mode)

Arguments

path

Path to the file for which to change permissions.

mode

Character element. One of 'close' or 'open'.

Value

File permission changes.

Details

This function will change the target file permissions to protect it from accidental deletion and changes. When mode is set to "close", the function will apply a chmod code "444", making the file "read-only". If set to "open", the function will apply the chmod code "666", enabling changes to the file, including deletion. This will prevent other users from modifying the file, but will allow the user to If this function is ran in windows, the function will additionally use icacls to modify file permissions. Since windows cannot interpret the chmod codes.