Page 1 of 2

Mirror Tagged Folder Contents in Dropbox?

PostPosted: Sun Mar 19, 2023 6:47 am
by noisyneil
Hi. I wonder if Hazel might be the tool for this...?

I have a Smart Folder in the Finder that contains a number of project folders which have been tagged to indicate they are in currently in progress.

Within each project folder will be one or more .m4a audio files. These are the current work-in-progress versions of each project and I'd like these all to be copied to one dedicated Dropbox folder.

If a project folder is then untagged (and thereby removed from the Smart Folder), I'd like its copied audio files to be removed from the Dropbox folder.

It seems like Hazel might be the tool for this, but I suspect Keyboard Maestro might be needed for the file removal part...

Any thoughts or alternative ideas are welcome. Thanks in advance.

Re: Mirror Tagged Folder Contents in Dropbox?

PostPosted: Mon Mar 20, 2023 10:01 am
by Mr_Noodle
Hazel won't be able to process the removal if it's individual files. If you, instead, sync the folder containing those files over, then that would reflect the state of whether the files are there or not.

Re: Mirror Tagged Folder Contents in Dropbox?

PostPosted: Mon Mar 20, 2023 10:33 am
by noisyneil
Mr_Noodle wrote:Hazel won't be able to process the removal if it's individual files. If you, instead, sync the folder containing those files over, then that would reflect the state of whether the files are there or not.


Thanks for the reply. I'd be happy to do the removal part manually, so do you think the copy part might be possible?

Re: Mirror Tagged Folder Contents in Dropbox?

PostPosted: Mon Mar 20, 2023 8:16 pm
by noisyneil
Ok I've made some progress with this:

https://forum.keyboardmaestro.com/t/pro ... u=noisneil

There's one missing piece of the puzzle. Is there a condition that will detect if the file/folder count has gone up/down? I want to use Hazel to trigger a Keyboard Maestro macro whenever the number of files in the Smart Folder is reduced (i.e. one or more files or folders have been un-tagged).

Re: Mirror Tagged Folder Contents in Dropbox?

PostPosted: Tue Mar 21, 2023 9:58 am
by Mr_Noodle
If the smart folder is the folder being monitored by Hazel, then you can't really create rules to apply to the smart folder itself. Rules only apply to the items inside the folder being monitored. Is having the smart folder match the folders containing these files not a possibility?

Re: Mirror Tagged Folder Contents in Dropbox?

PostPosted: Tue Mar 21, 2023 10:04 am
by noisyneil
Mr_Noodle wrote:Is having the smart folder match the folders containing these files not a possibility?


Not sure what you mean by "the smart folder match the folders"...?

Re: Mirror Tagged Folder Contents in Dropbox?

PostPosted: Wed Mar 22, 2023 9:46 am
by Mr_Noodle
Set up the parameters so that the smart folder results are the folders containing the files, not the files directly. Not sure how doable it is but is worth looking into.

Re: Mirror Tagged Folder Contents in Dropbox?

PostPosted: Wed Mar 22, 2023 10:01 am
by noisyneil
That's already how I have it set up:

https://forum.keyboardmaestro.com/uploa ... 70c674.png

The folders are tagged and appear in the Smart Folder. I'd like to trigger an AppleScript if anything is untagged and therefore the number of items in the Smart Folder is reduced.

Re: Mirror Tagged Folder Contents in Dropbox?

PostPosted: Thu Mar 23, 2023 9:33 am
by Mr_Noodle
Number of items in the smart folder directly or in the subfolders?

Re: Mirror Tagged Folder Contents in Dropbox?

PostPosted: Thu Mar 23, 2023 9:47 am
by noisyneil
Directly.

Re: Mirror Tagged Folder Contents in Dropbox?

PostPosted: Fri Mar 24, 2023 9:09 am
by Mr_Noodle
Then it won't work. The rules are for items inside the folder being monitored, not for that folder itself.

Re: Mirror Tagged Folder Contents in Dropbox?

PostPosted: Fri Mar 24, 2023 9:13 am
by noisyneil
Ah ok. Thanks for the clarification.

Does this mean I could monitor the Smart Folder's parent folder instead? If so, how do I trigger a routine when an item (in this case the Smart Folder) decreases in size?

Re: Mirror Tagged Folder Contents in Dropbox?

PostPosted: Mon Mar 27, 2023 9:58 am
by Mr_Noodle
I'm not sure if Smart Folders have any metadata attribute for the number of items in it. You can try and test it but I have my doubts.

Re: Mirror Tagged Folder Contents in Dropbox?

PostPosted: Mon Mar 27, 2023 10:33 am
by noisyneil
How would you do it if it wasn't a Smart Folder but a regular one?

Re: Mirror Tagged Folder Contents in Dropbox?

PostPosted: Tue Mar 28, 2023 9:48 am
by Mr_Noodle
Hazel has a Sub-file/folder count attribute which you use against folders. I don't know if that works with Smart Folders though. There is a similar Spotlight attribute which, again, not sure if it works with Smart Folders.