Delete (hidden) RAW files from Viewer as once with JPG

Hey,

I can not cope with a very simple (?) Script for deleting files with the same extension - that is, the often mentioned case of raw + jpg files. As far as I've done a script that marks an additional file with the same name, I can not create a button in the built-in photo viewer. It's about this case:

  1. I filter the list to jpg files
  2. I open the first file, the browser only moves between jpg files.
  3. I want to delete the file - press DEL - only the jpg file is deleted. I would like to delete every file with the same name.
  4. If it can not be programmed under the DEL key, I would like to add a DELETE JPG + RAW button in the panel, which will delete all files.

I did something like this to point 4, but it does not work:

Select DESELECTNOMATCH SETFOCUS EXACT PATTERN = "{file | noext}"
Show VIEWERCMD = delete

Try this

Delete {file|noext}.*

Thanks, but where to try it? It's not files window, but photo viewer window. This button is there. I would to delete files without exiting from viewer.

Default action to delete file from photo viewer is here:
Show VIEWERCMD=delete

...and it's works - delete ONE file, which is in window. I would delete both (or more).

The standalone viewer can be customized, just like the normal listers.

...and this is what I wanna do :slight_smile: Above code is from Delete button from viewer. I woult to change it to delete all files.

Here's a button to drag into your standalone viewer's toolbar in customize mode:

Delete Similar.dcf (257 Bytes)

Does not work. It's the same as I create new button. It's not working in viewer but also in files list.

To confirm what i did:

  1. I edit toolbar and move button (to file list commands and opus photo viewer)
  2. I open photo and click on button - nothing deleted
  3. I did the same in file list - nothing happen too

Version 12, no additional scripts, plugins etc. Opus photo viewer.

Well, I am confused now. It works on Win7, but it does not on Win10. Both Opus test installations are unmodified. I ran out of ideas where to look for a solution. Guess we have to wait for Clark Kent to stop by.

You may need to use filepath instead of file.

Logout, please link your account and we can help in detail.

Linked!

Thank you!

Edit the command in the viewer toolbar so that it runs this (but see below for what I think is a better version):

Delete {file|ext=*}
Show VIEWERCMD=refresh 

(If needed, click Advanced in the button editor to switch it into multi-line mode.)

I think the main issue with lxp's original command was just due to filepaths with spaces causing automatic quoting, which then didn't work properly with .* added to the end of the path. Doing it this slightly different way means that Opus replaces the extension itself.

The second line was also added so that the viewer moves to the next file after you delete the current one. (The viewer will close if there are no more images and it's configured to do that.)


Important note: This seems slightly dangerous as-is. If you have these files:

  • Cat.jpg
  • Cat.Eating.jpg

Then running the command on the first file will delete Cat.* which will delete both files, even though the second file doesn't really have anything to do with the first one.

Maybe you actually want that. If not, I think this is better:

Delete {file|ext=#[~.]}
Show VIEWERCMD=refresh 

Using the same example, that will only delete files named Cat.X where X is any string that does not contain any . characters. So it would delete Cat.jpg and Cat.txt but it would not delete Cat.2.bmp.


You could also do this if you want to only delete specific extensions (.bmp and .jpg in this example):

Delete {file|ext="(bmp|jpg)"}
Show VIEWERCMD=refresh 

Note that if the current file doesn't actually have one of those extensions then it won't be deleted, but the matching files still will be.


Whichever you use, make sure the Recycle Bin is enabled while testing, in case it doesn't do exactly what you expect.

1 Like

Simply amazing and amazing simply :slight_smile: Thank You, that will help me so much :slight_smile:

I think I opened Pandoras' Box - I found two "bugs". Not sure there are bugs at all but side effect for sure.

  1. I filtered filelist to *.jpg files
  2. I opened first one, photo viewer move between *.jpg files
  3. I delete file using "Delete {file|ext=*} ; Show VIEWERCMD=refresh" (I prefer this one, because some of files may have additional surfix and it's ok to delete it). And it's works, yahoo!
  4. Photo viewer jump to next file... but wait... it jump two files later (one is missed). It could count number of deletef files (two - jpg + raw) and move two jpg files later. (first bug)
  5. Some of files have surfix "(1)" - for autorename for some files with the same name. And it can't be deleted by above code. (second bug)

It's not critical in this case, but maybe there is something wrong deeper in code. Or... just script is too simple :slight_smile:

When I try it it seems OK. It correctly jumps to the next file that hasn't been deleted.

The total file count may be wrong in some cases, because it may only notice a file has been deleted when it tries to load it and finds it is not there, at which point it will update its list/count, but it should jump to the next file that hasn't been deleted. (Tested with 12.14.)

Change {file|ext=*} to {file|ext=*|escwild} which should fix that part.

1 Like

Ok, we have another issue here :slight_smile: Now script want to delete much more files than expected. Here is example:

  1. I want to delete file "2018-04-26 09.56.20.JPG". Additionally 2018-04-26 09.56.20.ORF should be deleted.
  2. I press delete and... 8 files deteled! Here is list of deleted photos:

2018-04-26 09.56.07.JPG
2018-04-26 09.56.07.ORF
2018-04-26 09.56.15.JPG
2018-04-26 09.56.15.ORF
2018-04-26 09.56.20.JPG
2018-04-26 09.56.20.ORF
2018-04-26 09.56.53.JPG
2018-04-26 09.56.53.ORF

First version of script: {file|ext=*} works and delete only two files, but does not work with (1) etc.

And I still have the same problem after delete pair of photos that picture viewer skip (at last) one photo. I need to back and check what was between deleted photo(s) and curently showed photo.

That's a bug. We've fixed it for the next beta. Sorry about that!

1 Like