#!/bin/bash

[ "$#" -eq 0 ] && DIR_PATH=/mnt/union/movies
while getopts p: flag
do
  case "${flag}" in
      p) DIR_PATH=${OPTARG};;
      *) echo "Error: No or wrong parameter provided. \n The scripts expects -d directory path params." && exit 1
  esac
done

sudo find "$DIR_PATH" ! -user dbi -exec chown dbi:fs_data {} \;