This snippet will find all RAW files that are part of RAW+JPEG pairs of the current selection and moves those RAW files to the library trash.
// Delete RAWs of Selected RAW+JPEG Pairs
// Returns the RAW file node of a RAW/JPEG pair
function getSecondaryRAW(materializations)
{
var ret = null
var have_jpeg = false
for (var i = 0; i < materializations.length; i++)
switch (getImageFileClass(materializations[i].path())) {
case "raw":
ret = materializations[i]
break
case "jpeg":
have_jpeg = true
break
}
return have_jpeg ? ret : null
}
var deleted_files = []
// find RAW files of any selected RAW/JPEG pairs
var inds = getSelection()
var items = getItems()
for (var i = 0; i < inds.length; i++) {
var file = items[inds[i]]
var materializations = getMaterializations(file)
var raw = getSecondaryRAW([file].concat(materializations))
if (raw !== null) deleted_files.push(raw)
}
// move the matching RAW files to library trash
print("Deleting RAWs:")
for (var i = 0; i < deleted_files.length; i++)
print(" " + deleted_files[i].path())
library.moveFilesToLibraryTrash(deleted_files)
Installation
- Copy the snippet source code above to the clipboard
- In Aspect, go to the “Snippets” page of the settings dialog and click “Add Snippet…”
- Paste the source code into the “Source Code” area - the “Menu Entry” field will be filled out automatically
The new menu entry should now be visible in the “File” menu and you can also optionally assign a keyboard shortcut in the “Shortcuts” section of the settings dialog.