ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: schultzter on August 05, 2014, 04:45:03 PM

Title: Set owner:group of new directories and files
Post by: schultzter on August 05, 2014, 04:45:03 PM
I've searched the forums and googled but haven't found anything.

I'm using ExifTool to manage the photos coming off my family member's phones onto the NAS. I add an Artist tag and sort the images into a common gallery by year and date. Here's the command I use:

/opt/Image-ExifTool-9.67/exiftool -recurse -progress -preserve -overwrite_original -d /media/Galleries/%Y/%Y-%m-%d/%%f%%+c.%%e "-Author=${AUTHOR}" "-FileName<CreateDate" /backup/${SOURCE}/DCIM

I'm running that command directly on the NAS so it's all local rather than back-and-forth over the network. But that means the command is run as root and the new directories and moved files all belong to root:root. I would like them to belong to media:users (media user and the users group).

So is there a way to either
I can't just run ExifTool as the media user since it isn't a real user (it's just the owner of the media share) and besides, I need permission to delete the old files from /backup share/directories.

Thanks,
Title: Re: Set owner:group of new directories and files
Post by: Hayo Baan on August 05, 2014, 05:21:02 PM
Solution 1 can easily be implemented with a find command. Something like find folder -user root -exec chown media:users {} \; will change the owner of all files currently owned by root in folder to media:users.

Hope this helps,
Hayo
Title: Re: Set owner:group of new directories and files
Post by: schultzter on August 05, 2014, 05:25:45 PM
Quote from: Hayo Baan on August 05, 2014, 05:21:02 PM
Solution 1 can easily be implemented with a find command

Thanks. Perhaps I don't know the find command well enough, I'll add that to my script.