6 Replies Latest reply on Apr 30, 2012 8:49 AM by don6397

    Detect External Hard Drive & Saving Files


      I have a single user FM solution that needs to be saved automatically to an external hard drive connected to the same computer where the FM solution is located when the user exits the system.


      I would like to be able to:


      Identify if the hard drive has been connected to the computer containing the FM solution before the file is saved?


      Use a unique file name generated each time the file is saved to the hard drive? Don't want to delete previous saved files.


      Does anyone have any ideas as to how to do this?

        • 1. Re: Detect External Hard Drive & Saving Files

          1.Store a fixed file "exists.txt" on your hard drive; use a plugin, to check if the file exists (e.g. Troi File or BE plugin).
          2.Include current time stamp into the name of the backup file to make it unique.


          • 2. Re: Detect External Hard Drive & Saving Files

            What is the script needed to include the time stamp in the backup file name?

            • 3. Re: Detect External Hard Drive & Saving Files

              Why check before saving the file? If the save fails, an error would be generated in either case, and in both cases they'd have to plug the drive in.


              The bigger issue is that you're trying to get FMP to save a file that is currently open to save a copy of itself some place else. You in effect are trying to pull the rug out from under your feet. Depending on what other scripts may have been halted or windows open, you won't be able to get FMP to save a copy of an open file, and even if you could, it would probably not be a valid copy. You could create a second FMP db that would perform the backup once the "main" file is closed.


              You're better off using a backup program that would be activated when they shut the computer down to save a copy of certain files on another drive. This really is an excellent reason for using FileMaker Server as it can back up active files properly to any valid location.




              • 5. Re: Detect External Hard Drive & Saving Files

                FMP can save a copy of a locally opened file (in fact it cannot save a file unless it's already got it opened) but the problem is relying on the backup script being run at file exit. If the file is explicitly closed using the Close command then yes the onLastWindowClose script gets triggered. However, if the user issues the Quit/Exit command then it does NOT get fired. The lights have gone out, the rug has been pulled out from under you. (I dont think a lot of people realise this.)


                IMHO the best solution for backup is FM Server. (Yes, I know all the arguments about costs etc but it IS the best solution.) Second best might be to prompt to make the backup at the start of the user session, not the end. That way you know the process isn't in a race condition with the closing of the file.

                • 6. Re: Detect External Hard Drive & Saving Files

                  Thanks Bruce for your suggestion.  It's exactly what I was looking for!


                  I was not aware of the website, but I now have it bookmarked...Don