I have folder mounted using gcsfuse, and copying folders using finder is too slow, so i use gsutils in a bash script, is it possible to replace the default copy action in this folder using an AppleSctipt that runs my script? So if i drag a folder to this mounted folder it would copy using the script instead of the normal way.
Asked
Active
Viewed 58 times
1 Answers
0
You can call the bash script from AppleScript and call this using "Folder Actions" on, for example, adding a file to the folder.
All the details you need are here:

Lorccan
- 793
- 5
- 20
-
but it allows me to replace the normal copy action? – José Pedro Machado Mar 30 '21 at 10:41
-
You don't replace the Finder copy action, you just use a different one. The "Folder Action" is attached to the folder. When something that you want to monitor (e.g. adding a file) occurs, you choose what happens - so you call your script. – Lorccan Mar 30 '21 at 11:36
-
I created a script with the "adding folder items to" listener but i can't prevent the files from being copied – José Pedro Machado Mar 30 '21 at 14:00
-
Copied to where? – Lorccan Mar 30 '21 at 15:09
-
To the folder where I'm adding the script to. I want the folder to not be ccopied by the finder, and the only event they have is "adding folder items to" that only executes after the files are copeid, I want them to not be copied – José Pedro Machado Mar 30 '21 at 15:37
-
The only way you can do what (I think) you want is to create a new folder in the same location as your original file, then attach the folder action (and your script) to that one. Your file WILL be moved into that folder by the Finder, but you then decide what to do with it with your script. Alternatively you could just make an app droplet and drop your file on it to call your script - it’s really the same thing. – Lorccan Mar 30 '21 at 18:29
-
@JoséPedroMachado: if you don't want the files copied in the first place, you may have to use a different approach (say an AppleScript droplet app) which processes the files without moving them. You'll have to edit your question and explain more carefully what you're doing and what you want to happen, though. – Ted Wrigley Mar 30 '21 at 18:56