Page 1 of 1

Shell Script in Subfolders

PostPosted: Mon May 22, 2017 3:56 pm
by haupti
Hello again. :-)

Thats my status:

Folder1
------- Folder2
-------------picture1.jpg
-------------picture2.jpg
------- Folder3
-------------picture1.jpg
-------------picture2.jpg
------- Folder4
-------------picture1.jpg
-------------picture2.jpg

Folder1 => Hazel runs include Subfolders (Run rules on folder contents)
Script:
Code: Select all
exiftool $1 -title=$(basename ${PWD}) -overwrite_original


The script works fine, BUT: all Pictures got the Titel "Folder1" and not the folder name of each file.

I think the problem is, that the script runs at once, not again in each subfolder.

Thanks in advance for your help

Best regards
Bernd

Re: Shell Script in Subfolders

PostPosted: Tue May 23, 2017 11:23 am
by Mr_Noodle
What are the conditions for that rule?

Re: Shell Script in Subfolders

PostPosted: Tue May 23, 2017 12:10 pm
by haupti
Mr_Noodle wrote:What are the conditions for that rule?


Hello Mr. Noodle,
my idea is to add folder name as a title in the photos and than I would import to PHOTOS including the title name.
The problem is, that the photos in the subfolders also get the folder name from the main folder (as title).

So I think the problem is, that the script once in the main folder, but not in each subfolder. I thought the process is:
- go to picture in subfolder and run the script with the actually folder and so on

Code: Select all
exiftool $1 -title=$(basename ${PWD}) -overwrite_original

${PWD} takes only the main folder, not each subfolder

I hope You can me a little bit understand, sorry for my bad English.

Best regards
Bernd

Re: Shell Script in Subfolders

PostPosted: Wed May 24, 2017 11:14 am
by Mr_Noodle
Again, can you post the actual conditions in the rule? That determines what item gets matched which is the issue here.

Re: Shell Script in Subfolders

PostPosted: Wed May 24, 2017 11:37 am
by haupti
Hello Mr. Noodle,
sorry.... here my screenshots.
Best regards
Bernd

1st:
Image

2nd:
Image

Re: Shell Script in Subfolders

PostPosted: Wed May 24, 2017 12:59 pm
by haupti
I have my problem solved :-)

Code: Select all
var=$(dirname $1)
exiftool $1 -title=$(basename ${var}) -overwrite_original


Sure not nice... but it works fine :-)

Re: Shell Script in Subfolders

PostPosted: Thu May 25, 2017 10:49 am
by Mr_Noodle
Since you need to use a script anyways, I'd say that's totally fine.