79369066

Date: 2025-01-19 13:55:20
Score: 1
Natty:
Report link

What works best for me is to tell the Finder to copy the file to the clipboard. The finder takes care of all the details, different file classes etc.

osascript -e 'tell app "Finder" to set the clipboard to ( POSIX file "/Users/someuser/somefile.zip" )'

You need to provide an absolute path and e.g. avoid "~" (home directory).

I tested this with pasting to Finder windows, Apple Mail, MS Word...

Reasons:
  • Has code block (-0.5):
  • Starts with a question (0.5): What
  • Low reputation (1):
Posted by: Oliver Oppitz