Deleting Duplicate Notes in Notes.app using AppleScript
tell application “Notes”
set targetFolder to “Target” — Change this to your folder name
if not (exists folder targetFolder) then
display alert “Folder not found”
return
end if
set theNotes to notes of folder targetFolder
set noteNames to {}
set duplicates to {}
repeat with aNote in theNotes
set noteName to name of aNote
if noteNames contains noteName then
set end of duplicates to aNote
else
set end of noteNames to noteName
end if
end repeat
repeat with duplicateNote in duplicates
delete duplicateNote
end repeat
if length of duplicates is 0 then
display dialog “No duplicates found”
else
display dialog (length of duplicates) & ” duplicates deleted.”
end if
end tell
Please leave comments below.
*** This is a Security Bloggers Network syndicated blog from Joel Esler authored by Joel Esler. Read the original post at: http://blog.joelesler.net/2023/12/deleting-duplicate-notes-in-notesapp.html

