Thank you.

I knew it was a pathing issue, I even tried to add $dir to the is_dir parameters but I guess I was missing the other changes.