When comparing two folders on macOS there's a right-click option to "Reveal in Finder".
If multiple files are selected, however, only the first one is selected in the Finder window.
It would be fantastically useful to have them all selected so that you can easily use Quick View with them, or batch rename them, or perform other actions (even just see them in context).
It's possible to work around this by exporting the list and then using a command line script for the selection eg. this applescript suggestion or this little Swift app, but that's very long-winded.
I hope this is a feature enhancement that might be considered for adoption.
[Feature Request]: Reveal in Finder for multiple files
- Posts: 10
- Joined: 15 May 2023
- Posts: 1037
- Joined: 8 May 2006
(I don't know Mac, but...)
You might be able to set something up yourself?
Tools | Options -> Customize context menu:
Descr.
Open in Finder
Command line
Finder "%local_path%" "%local_path2%"
(now I have no idea if "Finder" is finders name, nor if any other parameters may need to be passed to it, but experiment & see if you can get something to work?)
You might be able to set something up yourself?
Tools | Options -> Customize context menu:
Descr.
Open in Finder
Command line
Finder "%local_path%" "%local_path2%"
(now I have no idea if "Finder" is finders name, nor if any other parameters may need to be passed to it, but experiment & see if you can get something to work?)
- Posts: 10
- Joined: 15 May 2023
Ah, clever!
New user, so didn't know that's how it worked.
(The option is at the bottom of Preferences on Mac, rather than under Tools.)
I'm not sure how to craft a solution with it, though...
The %local_path% macro doesn't pass a list or array, just a single file. So in the case of a multiple-file selection, the command is simply iterated that number of times.
If, for instance, you set up the following command
you get presented with a new dialog box for each file in sequence after clicking OK each time, and if you click Cancel the execution stops.
Similarly, if you choose "Open with default application" for image files, Preview opens multiple separate windows rather than a single window with all the images in a sidebar (as it would do if passed a list).
So would need to capture the filenames/paths...
New user, so didn't know that's how it worked.
(The option is at the bottom of Preferences on Mac, rather than under Tools.)
I'm not sure how to craft a solution with it, though...
The %local_path% macro doesn't pass a list or array, just a single file. So in the case of a multiple-file selection, the command is simply iterated that number of times.
If, for instance, you set up the following command
osascript -e 'display dialog "%local_path%" with title "FFS Context Menu Test"'
Similarly, if you choose "Open with default application" for image files, Preview opens multiple separate windows rather than a single window with all the images in a sidebar (as it would do if passed a list).
So would need to capture the filenames/paths...
- Site Admin
- Posts: 7211
- Joined: 9 Dec 2007
For the record: FreeFileSync can also preview images. Right-click on column header and select "medium" icon size.
- Posts: 10
- Joined: 15 May 2023
That is really useful, and your application overall is unbelievably brilliant!For the record: FreeFileSync can also preview images. Right-click on column header and select "medium" icon size. Zenju, 16 May 2023, 09:33
Still, I wanted to be able to have the selected items transferred across to a finder view...
So the following is the best I have been able to come up with.
If it's possible to add a "macro" that provides all the filenames as an array or list then I think the solution could lie with osascript within the existing terminal command paradigm.
However, for the time being the combination of a text file and this simple Applescript app does work and is reasonably robust, although it is excruciatingly slow. (Previously, I thought it would be even more cumbersome because I had only found the export to Excel feature, so the bash integration is great.) Hopefully it may help somebody else.
So, I added a Context Menu option to generate a text file of the filenames and save it at the bottom of the user's Home folder (alphabetically,) as suggested in the manual:
Write out list of filenames to txt file
echo %item_name% >> ~/zz_FreeFileSync_file_list_%Date%-%Time%.txt
No doubt it could be vastly improved, but it does the job for my fully controlled needs and doesn't blow up... probably... I haven't tested with a large number of files or anything...
# FreeFileSync Reveal in Finder Multiple Selection Tool
set theFreeFileSyncFileList to choose file with prompt "Please select the file_list text file generated via FreeFileSync's context menu using the <echo %item_name% >> ~/zz_FreeFileSync_file_list_%Date%-%Time%.txt> command:" of type "txt" default location (path to home folder)
set thePathResponse to display dialog "What is the full path (without quotes) of the parent folder for these files? Simply copy & paste it from the top of the relevant FreeFileSync pane." default answer "" with icon note buttons {"Cancel", "Continue"} default button "Continue"
set parentFolder to text returned of thePathResponse
set activeFolder to POSIX file parentFolder
on returnFileContentsAsArray(theFile)
set fileHandle to open for access theFile
set theItems to paragraphs of (read fileHandle)
close access fileHandle
return theItems
end returnFileContentsAsArray
set theFilesOfInterest to returnFileContentsAsArray(theFreeFileSyncFileList)
tell application "Finder"
activate
set multiSelection to items of folder activeFolder whose name is in theFilesOfInterest
reveal multiSelection
end tell
- Site Admin
- Posts: 7211
- Joined: 9 Dec 2007
More food for thought:
The simplest command to show a single file in Finder is the following, but it doesn't work with multiple file paths:
Here's an equivalent command using osascript:
And a variant for two files that maybe could be generalized to show any number of files:
The simplest command to show a single file in Finder is the following, but it doesn't work with multiple file paths:
open -R "%local_path%"
Here's an equivalent command using osascript:
osascript -e 'tell application "Finder" to reveal POSIX file "%local_path%"'
And a variant for two files that maybe could be generalized to show any number of files:
osascript -e 'tell application "Finder" to reveal every item in {POSIX file "/folder/file1", POSIX file "/folder/file2"}'
- Posts: 10
- Joined: 15 May 2023
Yes, indeed:
But I can't see how to get the list of files without a new eg. %items_list% macro, because there's no way to set up a persistent variable in memory to append them to if the whole command is executed for each file sequentially.If it's possible to add a "macro" that provides all the filenames as an array or list then I think the solution could lie with osascript within the existing terminal command paradigm. ClutterCutter, 16 May 2023, 15:01
- Site Admin
- Posts: 7211
- Joined: 9 Dec 2007
I've solved that part: "%local_paths%" etc. would resolve to all selected paths. Multiple identical command lines (after path resolution) would be aggregated to only one. This means there would be only a single command line execution for multiple files.But I can't see how to get the list of files without a new eg. %items_list% macro, because there's no way to set up a persistent variable in memory to append them to if the whole command is executed for each file sequentially. ClutterCutter, 20 Jun 2023, 19:19
Remaining question:
How could %local_paths% ever resolve to something like this?
{POSIX file "/folder/file1", POSIX file "/folder/file2"}'
- Posts: 10
- Joined: 15 May 2023
Ah, I see. Well, the script can be constructed via osascript: it takes multiple -e statements, so a multi-line script can be built and be quite sophisticated.
Might be best to separate the folder and the items, as I did in my script above, which was based on this comment.
If the %item_names% macro expands correctly on the command line, it can go straight into an applescript list. Delimiters are flexible.
Might be best to separate the folder and the items, as I did in my script above, which was based on this comment.
If the %item_names% macro expands correctly on the command line, it can go straight into an applescript list. Delimiters are flexible.
- Site Admin
- Posts: 7211
- Joined: 9 Dec 2007
The following macros have been added for the next version:
https://freefilesync.org/manual.php?topic=external-applications
Here's the current beta version for testing:
https://www.mediafire.com/file/1ezuvynauq3xtyz/FreeFileSync_12.5_%255BBeta%255D_Windows_Setup.exe
https://www.mediafire.com/file/ent5k2bxp7pj809/FreeFileSync_12.5_beta_macOS.zip
Details can be found here:%item_paths%
%local_paths%
%item_names%
%parent_paths%
https://freefilesync.org/manual.php?topic=external-applications
Here's the current beta version for testing:
https://www.mediafire.com/file/1ezuvynauq3xtyz/FreeFileSync_12.5_%255BBeta%255D_Windows_Setup.exe
https://www.mediafire.com/file/ent5k2bxp7pj809/FreeFileSync_12.5_beta_macOS.zip
- Posts: 10
- Joined: 15 May 2023
Excellent! :)
I think I may have misled you, however. Sorry.
I haven't looked at the beta as yet, and am far from an Applescript expert, but presumably the filenames/paths are output in quotes, since they may contain spaces?
Applescript's set item delimiter does indeed allow for flexibility in extracting items from a string into a list/array, but if the string itself has quotes in it there's an obvious problem in determining where it ends, so I believe this won't work:
but this will (because it's the format of an Applescript list anyway):
and this will (because it can be parsed using set to paragraphs of):
I think I may have misled you, however. Sorry.
The separator may need to be a comma, actually; or the list be formed of each item on a new line.To generate a list including all selected items (separated by space), append "s" to the macro name
I haven't looked at the beta as yet, and am far from an Applescript expert, but presumably the filenames/paths are output in quotes, since they may contain spaces?
Applescript's set item delimiter does indeed allow for flexibility in extracting items from a string into a list/array, but if the string itself has quotes in it there's an obvious problem in determining where it ends, so I believe this won't work:
"Filename1" "Filename2" "Filename Three" "Filename Four"
"Filename1","Filename2","Filename Three","Filename Four"
Filename1
Filename2
Filename Three
Filename Four
- Site Admin
- Posts: 7211
- Joined: 9 Dec 2007
In my tests the list also needed the "POSIX file" parts. So %local_paths% needs to be propagated to a script as command line arguments.
- Posts: 10
- Joined: 15 May 2023
I've just quickly tested this and it works (all one command line)
So, in this example, would just need "%parent_path%" (quotes added on command line) to resolve to "/Users/ClutterCutter/Pictures/Some Pictures/These Pictures/A Folder of Pictures"
and
%item_names% (no quotes) to resolve to "Picture1.jpg","Picture2.jpg","Picture_3.jpg","Picture Four.jpg","Picture Five.jpg","Another Picture.jpg"
osascript -e 'set activeFolder to POSIX file "/Users/ClutterCutter/Pictures/Some Pictures/These Pictures/A Folder of Pictures"' -e 'set theFilesOfInterest to {"Picture1.jpg","Picture2.jpg","Picture_3.jpg","Picture Four.jpg","Picture Five.jpg","Another Picture.jpg"}' -e 'tell application "Finder"' -e 'activate' -e 'set multiSelection to items of folder activeFolder whose name is in theFilesOfInterest' -e 'reveal multiSelection' -e 'end tell'
and
%item_names% (no quotes) to resolve to "Picture1.jpg","Picture2.jpg","Picture_3.jpg","Picture Four.jpg","Picture Five.jpg","Another Picture.jpg"