13 Replies Latest reply on Mar 20, 2007 1:49 PM by HKabaker

    Auto-delete of unused graphics?

    ChrisBrewster Level 1
      I often replace screenshots with improved versions, so I have a buildup of unused graphics on my disk. In most cases I know at sight which ones are no longer used. But RH itself "knows" which ones are in use-- if I hit Ctrl-G, it shows a list of graphics. And, if I delete a graphic from the document, it disappears from the list. So I'm wondering if RH has the ability to purge the directory of files that aren't in use.

      BTW, I know I'm not using the "approved" way of handling graphics, but my screenshots simply don't need their own readable file names. The automatically generated names do fine for me.
        • 1. Re: Auto-delete of unused graphics?
          Peter Grainge Adobe Community Professional (Moderator)
          No way that I know of.

          • 2. Re: Auto-delete of unused graphics?
            HKabaker Level 2
            It's best to rename the new graphic to match the old one.

            Double-click the old graphic in the topic and click the navigation icon at the upper right. Find the new graphic, click Open, and say OK to overwriting the old one.

            It's not a lot of effort, and it has the advantage of replacing graphics in the publish directory automatically the next time you publish, rather than leaving old ones lying around.

            Another way is to get a list of unused files from RH reports, go into the project folder (RH is closed) and manually delete them. This isn't much effort, but still leaves you with obsolete graphics in the publish directory.

            Harvey

            • 3. Re: Auto-delete of unused graphics?
              ChrisBrewster Level 1
              HKabaker, in your last line you say "but still leaves you with obsolete graphics in the publish directory." I'm not sure what you mean. If I delete a file from the disk directory, are you saying that a copy of it still exists somewhere else?
              • 4. Re: Auto-delete of unused graphics?
                ChrisBrewster Level 1
                I accomplished what I wanted using VBA. I made a list of all the "image..." files using a 3rd-party directory program like WinExplorer (but better). Then I got RH's report about graphic files in use. My VBA file looks in the first file for a file name and searches in the second. If it's not there, the file is deleted. The number of files went from 715 to 245. (That number doesn't count the earlier ones that I did the "right" way with named files.)

                A co-worker suggested that a DOS batch script could do it, which would be more elegant, but I'm not good enough at the language. He thought it would look something like...

                for /F "usebackq" %%i in (`dir /b /A:d`) do @(echo %%i & find %%i fileName & if NOT ERRORLEVEL 0 (del %%i))

                If someone here is good at DOS batch scripts, this would be a better solution I think, because it would need only RH's report as input.
                • 5. Re: Auto-delete of unused graphics?
                  Captiv8r Adobe Community Professional & MVP
                  Hi Christopher

                  Just an observation here. Why bother with the Tools > Reports > Images when you have Tools > Reports > Unused Files available?

                  Just thinking out loud... Rick
                  • 6. Re: Auto-delete of unused graphics?
                    ChrisBrewster Level 1
                    Well... I didn't know about it. Part of my VBA would have been unnecessary, but it was the easy part.

                    Anyway, in the help for the unused files report, the following sentences appear consecutively. They seem to be giving opposite messages. Can anyone clear this up?

                    You'll need to use the Windows Explorer to open your project folder, locate the files and delete them from your system.

                    Important! Avoid using Windows Explorer or your version control application to remove files.
                    • 7. Re: Auto-delete of unused graphics?
                      HKabaker Level 2
                      "Important! Avoid using Windows Explorer or your version control application to remove files."
                      This is excellent advice.

                      However, you can delete a file from the project folder in Windows Explorer under these conditions:

                      You are certain the file is not referenced in RH at all, or
                      The file is listed in the RH unused files report.

                      AND (another guard against confusing RH)
                      The project is not open in RH.

                      The reason for the warning is the RH database will get confused if you delete or move active files between folders within the project folder, whether the project is open or not.

                      Good luck.

                      Harvey
                      • 8. Re: Auto-delete of unused graphics?
                        bawd Level 1
                        'Scuse me, Rick, but where do you find 'Tools > Reports > Unused Files' in your RH? It's not an option in my X5.

                        Forgive me if I'm missing a point somewhere.

                        Brian (as in bawd)
                        • 9. Re: Auto-delete of unused graphics?
                          Peter Grainge Adobe Community Professional (Moderator)
                          Tools | Reports | Unused Files works for me in RH HTML X5.

                          • 10. Re: Auto-delete of unused graphics?
                            HKabaker Level 2
                            Chris,

                            Going back to your earlier question:

                            ". . . in your last line you say "but still leaves you with obsolete graphics in the publish directory." I'm not sure what you mean. If I delete a file from the disk directory, are you saying that a copy of it still exists somewhere else? "

                            If you are using the Publish function to deliver WebHelp files to a server, RH sends all graphics from your project folder (even the "unused" ones). The Publish function never deletes a file from the server. This is standard FTP behavior.

                            If your replacement image has a different name, the old one remains in your project file as an unused image, as you know.

                            In addition, the next time you publish WebHelp, the original image remains as an orphan in the publish directory. (It is the same, for that matter, for a topic you have deleted from the project and no longer has any references in links, TOC, Index and Search database. It does no harm, but for tidiness it needs to be deleted manually from the server.)

                            This is why, unless there is a reason to use a different file name for a substitute graphic, I give it the same name as the one I'm replacing. When I first insert it into the project, it replaces the originial. When I publish, it overwrites the original in the server directory.

                            Harvey

                            • 11. Re: Auto-delete of unused graphics?
                              bawd Level 1
                              Tools | Reports | Unused Files

                              A bonus denied to us dinosaurs using RH for Word, it seems.

                              Brian
                              • 12. Re: Auto-delete of unused graphics?
                                ChrisBrewster Level 1
                                HKabaker writes "... the next time you publish WebHelp, the original image [with a no longer used file name] remains as an orphan in the publish directory. ... When I publish [new file using old file name], it overwrites the original in the server directory."

                                The help system that I write is sent out with a software release. If the new system is installed in the same location as the old one, is it ever done to request that the location be purged first and install the system clean? There are quite a few sites for this system. Thanks for the explanations.
                                • 13. Re: Auto-delete of unused graphics?
                                  HKabaker Level 2
                                  You need to find out from the people who distribute your application.

                                  If you are giving them a complete new WebHelp package, probably they are doing a complete replacement for the client's installation.

                                  Harvey