markogresak/cloud-ignore-files

Multiple paths

jacob-j opened this issue · 3 comments

Hello!

Awesome script, works like a charm! Thank you for making this.
Is it possible to add multiple paths? If I run the script again, it will just change the path right?
For example, I have some projects in /Projects but also in /Clients, so would want projects to be synced to /cloud/projects and clients to /cloud/clients.

Of course I could just move them to a parent directory, but would be cool if its easy to implement :)

Kind regards

Hi @jacob-j, if I'm not mistaken, unison supports only a single path (docs, see "Preferences" section).

You could set up two separate scripts, one takes care of /Projects <-> /cloud/projects and the second one to handle /Clients <-> /cloud/clients. This can be done easily by modifying local_path, cloud_path and label values inside the install script. I tried to write helpful comments, but I'll explain it again just to be sure:

  • local_path: path where you want to copy from, e.g. /Projects
  • cloud_path: path where you want to copy to, e.g. /cloud/projects
  • label: identifier of the, i.e. script/service name. It's important to change this or the first script will be overridden when you try to install the second one. Also, keep in mind to change the label accordingly if you use --uninstall feature.

I know this solution is not ideal, but I hope it's good enough. Let me know if that works for you.

Hello @markogresak.
Thank you for quick reply :)

Cool, that sounds good. Thought the label were some protection for Apple Developer validation or similar. I will rename it for my different directories.
That solution will work fine!

Thanks again!

I don't think the label really matters. I used the name to match the naming conventions of other launchd configs.

If you take look at Creating Launch Daemons and Agents - Creating a launchd Property List File, you can see that there is no limitations about the label value, other than it being unique. I would suggest following a template com.[username].[some_name] to follow the launchd config naming convention and make sure you're using a unique config name.