Announcement

Collapse
No announcement yet.

Delete 2 files at once - same name, different extension

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    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
    It seems to me that the way to go is convert the PDF files to images, then delete the PDF files as you go.
    Before you post ... Edit your profile • IrfanView 4.62 • Windows 10 Home 19045.2486

    Irfan PaintIrfan View HelpIrfanPaint HelpRiot.dllMore SkinsFastStone CaptureUploads

    Comment


      #3
      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.

      Comment


        #4
        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.
        Before you post ... Edit your profile • IrfanView 4.62 • Windows 10 Home 19045.2486

        Irfan PaintIrfan View HelpIrfanPaint HelpRiot.dllMore SkinsFastStone CaptureUploads

        Comment


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

          Comment


            #6
            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?

            Comment


              #7
              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, 05:47 PM.
              My system: IrfanView 4.62 64bit, Windows 10 22H2, Intel Core i5-3570, 16GB RAM, NVidia GTX 1050Ti 4GB

              Comment


                #8
                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.

                Comment


                  #9
                  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.
                  My system: IrfanView 4.62 64bit, Windows 10 22H2, Intel Core i5-3570, 16GB RAM, NVidia GTX 1050Ti 4GB

                  Comment


                    #10
                    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.

                    Comment


                      #11
                      Batch file is a simple script for Command prompt in Windows.

                      I'm not sure if there is a simple way to move files to Recycle Bin using a batch script.
                      I don't know if it's possible to instruct IrfanView to automatically go to the next file.

                      Adding the confirmation to the batch file/script is not difficult.

                      Code:
                      @echo off
                      
                      rem Ask the user
                      set /P c=Are you sure you want to delete the files [Y/N]?
                      
                      rem Was the answer Y=yes?
                      if /I "%c%"=="Y" goto DeleteFiles
                      
                      rem Do nothing and exit the script
                      exit /B
                      
                      :DeleteFiles
                      rem Delete the files
                      del %1
                      del "%~d1%~p1%~n1.pdf"
                      You have to type "y" and press Enter to confirm the deletion.
                      My system: IrfanView 4.62 64bit, Windows 10 22H2, Intel Core i5-3570, 16GB RAM, NVidia GTX 1050Ti 4GB

                      Comment


                        #12
                        JendaLinda, thanks for clarifying what the script does and for updating.
                        Much appreciate it.

                        Comment

                        Working...
                        X