Jump to content

reveal file in finder support multi files


Alan He
 Share

Recommended Posts

That’s the way macOS does it. Try it in a Terminal:

 

open -R /some/path /another/path

 

open -R means Reveals the file(s) in the Finder instead of opening them. (see man -P 'less --pattern "^     -R"' open).


As you’ll see, even if you give multiple paths, it will only reveal one.

Link to comment
Share on other sites

1 hour ago, vitor said:

That’s the way macOS does it. Try it in a Terminal:

 

open -R /some/path /another/path

 

open -R means Reveals the file(s) in the Finder instead of opening them. (see man -P 'less --pattern "^     -R"' open).


As you’ll see, even if you give multiple paths, it will only reveal one.

 

 

If so, I will consider whether there is a way by AppleScript.

 

Link to comment
Share on other sites

Spent more time with it, and JXA suffers from a bug (I had encountered it before in the context of deleting) where one can only act on one file, multiple files, or one directory. If there is a directory in the list and one other path, it breaks. But regular AppleScript can do it:

 

on run argv
  set pathList to {}

  repeat with pathString in argv
    copy ((POSIX file pathString) as alias) to the end of the pathList
  end repeat

  tell application "Finder" to select pathList
end run

 

Link to comment
Share on other sites

8 hours ago, vitor said:

Spent more time with it, and JXA suffers from a bug (I had encountered it before in the context of deleting) where one can only act on one file, multiple files, or one directory. If there is a directory in the list and one other path, it breaks. But regular AppleScript can do it:

 

on run argv
  set pathList to {}

  repeat with pathString in argv
    copy ((POSIX file pathString) as alias) to the end of the pathList
  end repeat

  tell application "Finder" to select pathList
end run

 

 

 

thank you.

 

I found method to support diff directory. 

 

 

just like this.

 

 

https://gist.github.com/alanhg/b6ac5adfb4c029fe44d933f998b9fbaa

 

 

image.thumb.png.69ab2beda47dcc7d3daafecf53d3a295.png

 

 

 

 

Edited by Alan He
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...