2

I am try to take a Finder selection and assign a specific content creator value to pdf files using applescript and xattr. While the script compiles fine, it doesn't actually modify the metadata item. If I run mdls -n kMDItemCreator test.pdf I still get the old value of the kMDItemCreator. Any idea what I'm doing wrong?

-- Get the finder selection to pass to the repeat below
tell application "Finder"
    set finderSelectionList to selection as alias list
end tell

-- Change the content creator of the selected files

repeat with theFile in finderSelectionList
    tell application "Finder"
        set a to quoted form of POSIX path of theFile
        do shell script "xattr -w com.apple.metadata:kMDItemCreator 'some content creator'" & a
    end tell
 end repeat
GForce
  • 153
  • 2
  • 9
  • are you missing a space before adding & a? check also if you need admin privileges or if the file is protected. – Pat_Morita Jun 27 '17 at 23:28
  • On further investigation, these seems to be related to differences between how xattr and mdls read and write to the kMDItemCreator field. I will update if I learn more. – GForce Jul 01 '17 at 00:31
  • I am facing the same problem. did you find the solution ??? @GForce – Rhea Jun 08 '21 at 01:04
  • @Rhea I used the solution here: https://discussions.apple.com/thread/7999590 – GForce Jun 09 '21 at 12:35

0 Answers0