Please refer to the folder hierarchy below.
folder1 -> file11.txt -> file12.txt -> folder11.backup -> file111.txt -> file112.txt -> file113.bak -> folder111 -> and many more folders and files folder2 -> file21.txt -> file22.txt -> file23.bak folder2.backup -> file111.txt -> file112.txt -> folder111 -> folder112 -> file1121.bak -> file1122.txt -> and many more folders and files folder3 -> folder31 -> folder311 -> folder3111.backup -> file3111.txt -> file3112.txt -> folder3111 -> and many more folders and files -> folder3112 -> file31121.bak -> file31121.txt
I want change the ownership (chown) and permissions (chmod) with the following rules:
all folders/subfolders EXCEPT folders that ends in ".backup". In my example folder hierarchy, the following folders and their contents will be ignored: folder11.backup, folder2.backup and folder3111.backup
all files EXCEPT those that has the extension ".bak". But if the file irrespective of its extension is inside a .backup folder, these are excluded because of rule 1.
Thanks for the help. :)