Page 1 of 2 1 2 LastLast
Results 1 to 10 of 12

Thread: Delete 2 files at once - same name, different extension

  1. #1
    IV Amateur
    Join Date
    May 2020
    Posts
    18

    Default Delete 2 files at once - same name, different extension

    I use Irfanview to browse through image files and PDF files.
    I have this option in Properties/Settings, Extensions, Load custom file types:
    JPG|JPEG|PNG|PDF|TIF|TIFF|

    Browsing through PDF files is time consuming especially for large raster files.

    What I want to do was to convert them to image files and remove the PDF option above.

    However when I delete the image files, I also want the PDF to be deleted automatically as well.
    Is this possible using some type of script to do this?

  2. #2
    Moderator Enterprise User Bhikkhu Pesala's Avatar
    Join Date
    May 2007
    Location
    East London
    Posts
    6,625
    OS
    64-bit Win 10
    CPU Cores
    1

    Default

    It seems to me that the way to go is convert the PDF files to images, then delete the PDF files as you go.

  3. #3
    IV Amateur
    Join Date
    May 2020
    Posts
    18

    Default

    Thanks for responding.
    For each document, I need an image file for viewing and a PDF file for editing, commenting, etc. As suggested above the PDF files take much longer to scroll through. So if I only allow to view image files, this particular issue is gone.
    But I still need to keep the PDF file for editing and commenting.
    There are several hundred documents, multiplied by several folders. So it's difficult to manage, by deleting the image file in Irfanview, going back to Explorer to find the document and deleting the PDF file.
    I thought there may be a small chance that it could be done with a script in Irfanview, otherwise would appreciate guidance on where I might find the answer.

  4. #4
    Moderator Enterprise User Bhikkhu Pesala's Avatar
    Join Date
    May 2007
    Location
    East London
    Posts
    6,625
    OS
    64-bit Win 10
    CPU Cores
    1

    Default

    What DPI do you use for loading PDF files in IrfanView, Settings, Plug-ins, PDF Options?

    If you use much more than 96 dpi that will improve quality, but has a significant effect on the speed of loading.

  5. #5
    IV Amateur
    Join Date
    May 2020
    Posts
    18

    Default

    Yes, I know about the DPI.
    Please refer to the original question.

  6. #6
    IV Amateur
    Join Date
    May 2020
    Posts
    18

    Default

    Can you please answer my question in the original post.
    Will it be possible to write a script or code, or something in the like, to do this in Irfanview.
    And if so, how can I get started?
    Or should I just abandon?

  7. #7
    IV Beginner
    Join Date
    Sep 2020
    Location
    Czech Republic
    Posts
    68
    OS
    64-bit Win 10
    CPU Cores
    4

    Default

    You may write a batch file, which will delete both files, and set is as an "external editor" in IrfanView.

    To be more helpful, here is the code, which should work.
    Code:
    @echo off
    rem Delete the picture itself (the full file path passed in directly from IrfanView)
    del %1
    rem Delete the PDF file (extract the drive letter, path and base file name and add the extension)
    del "%~d1%~p1%~n1.pdf"
    Last edited by JendaLinda; 08.10.2020 at 05:47 PM.
    IrfanView 4.56 64bit, Windows 10 20H2

  8. #8
    IV Amateur
    Join Date
    May 2020
    Posts
    18

    Default

    Apologies for the late response as the notification ended up in my Spam folder.
    Thanks for providing the above code as I thought it was probably not going to be possible.
    I have a few questions as I don't know enough about batch files.
    - What do you mean by "external editor"?
    - Where is the batch file saved?
    - How do I tell Irfanview to communicate with the batch file.

    Again thanks for assisting but I probably will have additional questions following the above.

  9. #9
    IV Beginner
    Join Date
    Sep 2020
    Location
    Czech Republic
    Posts
    68
    OS
    64-bit Win 10
    CPU Cores
    4

    Default

    WARNING: The batch file is written in the simplest way possible. It will delete both files permanently without asking. You may want to add some kind of confirmation to the code.

    There is a command in the File menu, to open the file with an external editor.
    External editors can be set in the Settings in the miscellaneous section.
    You may save the batch file in any folder.
    Set the batch file in the settings as an external editor, then you can run the batch file using the menu command.
    You may also use a keyboard shortcut Shift+number.
    IrfanView 4.56 64bit, Windows 10 20H2

  10. #10
    IV Amateur
    Join Date
    May 2020
    Posts
    18

    Default

    This actually does work. Thanks for writing the batch file and explaining above.
    I'm guessing that scripts or batch files, whatever the correct terminology is, are generic rather than for Irfanview specifically.
    Therefore are there any examples or references available online, that I can use to progress on the following.
    - If permanently deleted adding the Confirmation you mentioned.
    - If possible, delete to the Recycle Bin. In this instance I won't need the above.
    - In Irfanview, when I delete a file normally using the "Delete" key, I go to the next file via: Options, Properties/Settings, File Handling, check the box "Jump to the next file after moving or deleting".
    Is there a way to script this in as it won't work when I use the script?

    I didn't think that this was actually going to be possible, so anything else is a bonus.
    Otherwise thanks for the above two posts.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •