I'm trying to make a shortcut via an automater service that will move the selected file(s) up a directory. It goes as follows:
Get Selected Finder Items
Get Value of Variable
Path
Run Applescript:
on join(someList, delimiter) set prevTIDs to AppleScript's text item delimiters set AppleScript's text item delimiters to delimiter set output to "" & someList set AppleScript's text item delimiters to prevTIDs return output end join to split(someText, delimiter) set AppleScript's text item delimiters to delimiter set someText to someText's text items set AppleScript's text item delimiters to {""} return someText end split on run {input, parameters} set pathToMe to POSIX path of (item 1 of input as text) set newPath to split(pathToMe, "/") set revPath to reverse of newPath set restList to rest of revPath set restList to rest of restList set joinPath to join(reverse of restList, "/") set source to POSIX file joinPath return source end run
Set Value of Variable
Parent
Move Finder Items To
Parent
The Applescript parses the first file path in the Path
in order to find the item's grandparent, returning it as a POSIX file string. The problem is that the "Move Finder" action only accepts Files/Folders. How can I select the target parent folder with the resulting string in order to pass it to the "Move Finder" action?
Things I've tried:
- Using
mv
in aRun Bash Script
: theRun Applescript
action doesn't seem to return anything to theRun Bash Script
; set to input as arguments, "$@" is always empty. - Doing a
tell finder
inRun Applescript
. No error or warning, just nothing happens. - Manually setting the value of the
parent
variable.
Thanks in advance!