How to get Automator to move a folder to Appname.app/Contents/etc

applescriptautomatorfinder

I'm trying to create an Automator Quick Action to move a selected folder into the Resources folder of an app, accessed by clicking Show package contents in the Applications folder.

There doesn't seem to be a way to move the folder there. I've tried Move Finder Items, but it doesn't allow me to select an app's package contents.

The closest I've gotten is to just drag the folder into Automator, and then store it in a variable, but for some reason, storing a value in one variable stores it in the other as well, which is really weird and prevents me from using this method.

Is there a way to do this, and if so, how would it be done?

Best Answer

This AppleScript code works for me using the latest version of macOS Mojave.

This AppleScript code allows you to choose the folder you want to move and to choose the application whose resources folder you want to use as the destination folder. It will then move the chosen folder to the destination folder. I hope this example sparks some ideas for you to use in your Automator workflow.

set folderYouWantToMove to choose folder

set appPath to (choose file) as text
set pathToResource to "Contents:Resources:"
set resourceFolder to (appPath & pathToResource) as alias

tell application "Finder" to move folderYouWantToMove to resourceFolder