I apologise for the delay in getting back to you with my answer. It's been more challenging than I had anticipated.
But it is possible to achieve what you want by creating a service in Automator, which will then become accessible via a keyboard shortcut (hotkey).
You'll need to follow this guide on Making a Systemwide Service.
Start by creating a new service in Automator. It will need to receive files or folders as input, and be made available in Finder.
Add a Run AppleScript action to the workflow. In the text area of that action, the following AppleScript can be copied and pasted:
use Finder : application "Finder"
property F_ : missing value -- The previous folder
property f : missing value -- The files that we moved
property home : Finder's home as alias
on run {f, _}
get its ParentFolderOf:(some item in f)
set there to the result -- The destination folder, one level up
-- We won't navigate any higher up the folder tree than
-- the home folder
if (its ParentFolderOf:home) is in there then return
-- Also don't apply this service to other folders that aren't
-- in the same branch of the folder tree as the home folder
if (there as text) does not begin with (home as text) then return
-- The folder we're currently at
tell Finder to set F_ to ¬
(the container of some item in f) as alias
-- Check to ensure there are no files in the destination folder
-- that risk being overwritten. If there are, we won't move
-- the files who share the same name, i.e. only move those that
-- are safe to move.
tell Finder to ¬
repeat with _g in f
get name of _g
set g to [there as text, result] as text
if not (g exists) then set end of f to _g
set f to the rest of f
end repeat
-- Move the files
tell Finder ¬
to set f ¬
to (move f to there) ¬
as list as alias list
-- Reveal them
reveal f
activate Finder
end run
to ParentFolderOf:(f as alias)
local f
set F_ to [f, "::"] as text as alias
if (f as text) ends with ":" then return F_
return its ParentFolderOf:F_
end ParentFolderOf:
Save the service as whatever you like. Automator automatically saves it in the right location (~/Library/Services). I saved mine as "Ascend in Finder".
Next, you have to create a keyboard shortcut. This is done through System Preferences:
Under the services list, you'll need to scroll down to the section marked Files and Folders, under which your service name should appear. You can see mine highlighted. I created the shortcut ⌃▲ for mine (Ctrl+Up).
Now, every time I select files and/or folders in Finder and press ⌃▲, those files and folders ascend one level up the hierarchy into their parent folder. If I want to move them back, I can press ⌘Z to undo the move.
I put a safeguard in so that files and folders wouldn't get moved any higher up the folder tree than your home folder. It's unlikely you'd need to anyway.
1
There's no built-in hotkey for that, but you can create such custom file actions with Alfred. Alfred also has built-in hotkeys for selecting the current file and moving it to any folder (using fuzzy matching). Requires the Powerpack though: https://www.alfredapp.com/powerpack/
– slhck – 2018-03-02T20:41:54.680Try asking here: https://apple.stackexchange.com/
– HackSlash – 2018-03-02T20:57:46.8701@slhck No need to use Alfred. You can create a Finder service with a keyboard shortcut that will do this for you. – CJK – 2018-03-02T21:29:24.907
@CJK such at this? https://www.macworld.com/article/1142601/makeaservice.html can you clarify the process for me to do this specifically?
– Gryph – 2018-03-02T22:46:43.910Yes, @Gryph, I’d be more than happy to. Bear with me, I’m actually having computer troubles right now. Once I’m sorted, I’ll draft an answer for you, or else I’ll do so from my iPad instead. – CJK – 2018-03-02T23:08:19.313
1@CJK Sure, technically there's no need for it, it's just quite a lot more work :) – slhck – 2018-03-04T19:14:38.117
1@slhck Yup, as I found out. It took me ages to write and test the script in my answer below! – CJK – 2018-03-04T21:20:41.993
The answer should be equally split between CJK (for effort and detail), slhck for coming up with something highly workable, and @Tetsujin for answering the question directly and with a so-obvious-should've-seen-that solution. I've upvoted all because all will solve this problem in different use cases for different people in the future. Thank you all. – Gryph – 2018-03-05T05:04:55.897