Auto-execute script after file copy or move

Any wishes
Posts: 192
Joined: Sun Jan 08, 2017 4:38 pm

Auto-execute script after file copy or move

Post by JayB » Thu Dec 09, 2021 10:22 am

Just an idea.

It would be nice (at least for me) to have an option to enable the automatic execution of a (shell) script on files (regular or directory files) after copying them from A to B, with source and destination paths as stdin, formatted for easy parsing in scripts, e.g. as json or CSV, and every copy operation separated by a new line character. This could be used, for example, to check if the destination path is on a backup volume, and if yes, perform a hash/integrity check (e.g. with EclecticLight's cintch CLI), or apply a hash attribute for later integrity checks. Or if the destination path is in /Applications, and if the file is an .app, then perform some automatic security checks.

(This would obviously be applicable only for copy processes manually performed by the user in NC.)

This would then need a tick box in Preferences, something like "Auto-run script after file copy" with either a button to "Choose script" to select the (shell) script proper or to just enter the script path manually (as in the tools preferences tab).

PS: you could extend the functionality to also execute the script after moving a file, either by default, or you could add another tick-box "Auto-run script after file move".