1 2 Previous Next 17 Replies Latest reply on Jul 8, 2014 11:31 AM by sjpockmire

    Simple Backup Script



      Simple Backup Script


           Hi, I've searched this forum but still unsure how to write a simple backup script that performs on close. I'm using FM 13 Pro on a Mac and all I want to do is on close, a copy of the file would be saved in a subfolder called "Backups" with the filename and timestamp. Can anyone help or point me to a post that might have this information? Many thanks.

        • 1. Re: Simple Backup Script

               The script found here: Saving Sequential Back Ups During Development

               can be adapted to do what you want to do. The version in this script saves a copy with a timestamp included in the name, but at periodic intervals. If you took the script performed by the installed timer and had it performed by the OnLastWIndowClose trigger in File Options, you'd get the results that you want.

          • 2. Re: Simple Backup Script

                 FM 12 & 13 have a File Option Script Trigger  under the File Menu - OnLastWindowClosed - Triggers a script to run before the last window is closed.

            • 3. Re: Simple Backup Script

                   I understand about the OnLastWindowClosed but I'm a newbie to complex scripting and have no idea what I entered, however when I did (see screenshot) my file is saved as "$Path" as a unix file in the existing folder? No timestamp or .FP12? Or, how do I have it navigate to the subfolder?

              • 4. Re: Simple Backup Script

                     In the "save a copy as" step, $Path should not be entered into the specify file dialog in quotes. It should be unquoted.

                • 5. Re: Simple Backup Script

                       Thank you - but now I get this error message? I have 500gb free.

                  • 6. Re: Simple Backup Script

                         That error message simply means that the file could not be created by your script. There are any number of reasons for that besides available disk space.

                         The file name and file path look valid. You'd get an error message that your file is read only if your database file is located in a folder for which you do not have write permissions.

                         You aren't hosting this file over the  network and testing this script from a client machine are you?

                    • 7. Re: Simple Backup Script

                           Hi, thanks for all your help. I'm on a Mac and only running on this machine. I even went to my folder options and made sure that all permissions were read and write. I tried one script I found in the forum (see attached) and it worked but I need the timestamp rather than day. I can live without the .fmp12 since I can always add that if I have to use the file. Given that, any suggestions how would I add the timestamp to this other script?

                      • 8. Re: Simple Backup Script

                             What version of filemaker are you using?

                             If you are using an older file version, all you need do is change the part of the calculation that appends the .fmp12 to the older file extension, .fp7.

                        • 9. Re: Simple Backup Script

                               Thanks. Filemaker 13. My question is, how do I change the other script to do a timestamp rather than day of the week? I tried several ways but just haven't hit it yet...

                          • 10. Re: Simple Backup Script

                                 If we change it, it becomes just like the one that isn't, for unknown reasons, working for you.

                                 The calculation, by the way, is one I've used a lot and it works for me. It drops out characters from the date and time that are not permitted as characters in a file name.

                                 A closer look at your calculation may show the issue. The calculation specifies a file extension of .fp12, instead of .fmp12.

                            • 11. Re: Simple Backup Script
                                   Hi, I still can't do a backup. There are several posts about error messages that read -
                                   Why do I get the error "[File name].fmp12 could not be created on this disk.  Use a different name, make room on the disk, unlock it or use a different disk"
                                   This is the same thing that I get. Do I need to set a path as to where to put the backup file? Thanks.
                              • 12. Re: Simple Backup Script

                                     The most common cause of that error message is to specify either an invalid file path or a file path to a location where the current user account does not have "write" permission.

                                     The example I provided does not specify a path, just the file name. In those cases, the script attempts to save the copy to the same folder as where the database file is located. (This is called a "relative file path". Since you need "write" access to that folder in order for your database to save changes made to it, this should also work for this script. The obvious exception to that idea is that you will not be able to save copies to that folder if your computer is hosted on a different computer via FileMaker Pro or FileMaker Server.

                                     At this point, it certainly wouldn't hurt to use a file path do a different folder on your computer, I just don't see why the current set up is failing on you.

                                • 13. Re: Simple Backup Script

                                       Do you work on a Mac or PC?

                                  • 14. Re: Simple Backup Script

                                         I have used both Mac and Windows systems, but have not owned/used a Mac in recent years. But from helping others here in the forum am quite confident that this will also work on Mac systems. There are only a few small differences in file paths between the two systems and none at all when you use a relative file path reference.

                                         Here's a quick test just to rule out possible issues with your OS:

                                         Put a copy of your database file on your desktop.

                                         Run the original version of this script, that does not specify a file path to where to save the copy.

                                         You should get a copy of your file on the desktop along with the original file.

                                         If that works then there is some issue with the original location where you had your database file that kept this from working. In which case, I suggest adding a filepath to a different folder as the place to which you save your back up copies.

                                    1 2 Previous Next