Custom action vs exec script

Running FileBot from the console, Groovy / FileBot scripting, shell scripts, etc
Post Reply
devster
Posts: 319
Joined: 06 Jun 2017, 22:56

Custom action vs exec script

Post by devster » 10 May 2019, 14:47

As --action now supports custom scripts with 2 parameters (as far as I could gather from the docs/code), does this imply that it can be used as an additional place for actions usually done by --exec?

For example, changing permissions, adding ACLs or converting links into absolute symlinks.

Is this appropriate or would exec still be better from a code perspective?
I only work in black and sometimes very, very dark grey. (Batman)

User avatar
rednoah
The Source
Posts: 16305
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Custom action vs exec script

Post by rednoah » 10 May 2019, 17:18

-exec is better suited for fixing permissions after files have been processed. If you're using your own --action then you can do absolutely anything, and so the FileBot history is disabled for these operations.

Notably, you can use + just like with find to run a single command with many file arguments, potentially making things much faster:

Code: Select all

-exec chmod 755 {f} +
:idea: Please read the FAQ and How to Request Help.

devster
Posts: 319
Joined: 06 Jun 2017, 22:56

Re: Custom action vs exec script

Post by devster » 10 May 2019, 18:44

Neat.
One of the main reasons was to use absolute symlinks, for some cases I find them very useful.

So if I may summarize the main differences between action and exec:
  • any custom action disables history, so it would need to be replicated in the action script if needed
  • actions do not have bindings available to exec (e.g. {n}, {t}, {f} and similar)
  • exec scripts support chaining arguments instead of running the command once for each file
I only work in black and sometimes very, very dark grey. (Batman)

Post Reply