Last active
February 18, 2017 03:07
-
-
Save gizzmo/aff240f6232857daad4e to your computer and use it in GitHub Desktop.
Script to maintain my media files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Take ownership | |
find /mnt/{Movie-Drive/Movies,Tv-Drive/Tv-Shows}/ \( ! -user mymedia -o ! -group mymedia \) -exec chown mymedia:mymedia {} \+ | |
# Set correct permission | |
find /mnt/{Movie-Drive/Movies,Tv-Drive/Tv-Shows}/ -type d ! -perm 775 -exec chmod 775 {} \+ | |
find /mnt/{Movie-Drive/Movies,Tv-Drive/Tv-Shows}/ -type f ! -perm 664 -exec chmod 664 {} \+ | |
# Secure files | |
find /mnt/{Movie-Drive/Movies,Tv-Drive/Tv-Shows}/ -type f -exec chattr +i {} \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment