Linux Tips

Selectively changing directory and file permissions.

PMS 1.31.1 and above monitor your media for file permission changes in addition to media content changes.

This was provided so PMS knows when your media acquisition processes (DVR/other tasks) complete and the media is now ready for PMS to use.

Unfortunately, a number of our users have a “sledgehammer” :hammer: approach where they just change all permissions for all media.

PMS is now sensitive to ALL permission changes (even for media already matched).

This results in the scanner activating.

The solutions here are:

  1. Have your post-processing task apply permissions correctly to the item(s) you’re adding as you add them

  2. Should you need to apply bulk changes, (which should be rarely), below is how to change only those files and directories which don’t match the desired permissions.

The two ‘find’ commands below scan for files whose permissions do not match the mode given and then performs a targeted -exec on that single file or directory to set to the appropriate value.

(Change the permissions below to be appropriate for your usage.)

find /directory-top -type d \! -perm 0755 -exec chmod 755 {} \; 
find /directory-top -type f \! -perm 0644 -exec chmod 644 {} \; 

Back to top

2 Likes