4 Replies Latest reply on May 21, 2015 8:30 AM by Paper_Queen

    Auto-backup script error: "...could not be created on this disk."

    Paper_Queen

      Title

      Auto-backup script error: "...could not be created on this disk."

      Post

      I followed the "Example backup script" in the local Help files, but keep getting the following error when it runs:

      "FM Receipts Copy.fmp12" could not be created on this disk. Use a different name, make more room on the disk, unlock it or use a different disk.

      I'm stumped, since (a) the script includes a step that adds the word "Copy" to the file name; (b) there's far, far, far more space on the disk than necessary; and (c) nothing is locked (that I can find).

      Here's my script:

      Set Field [ Receipts::Count Field ; Receipts::Count Field + 1 ]
      If [ Receipts::Count Field > 4 ]
           Save a Copy as [ “FM Receipts AutoBackup.fmp12” ; copy ]
           Set Field [ Receipts::Count Field ; 0 ]
      End If

      After that, I went to Files > File Options > Script Triggers. Clicked the OnLastWindowClose script trigger, then clicked Select, and selected my backup script. Clicked OK.

      The file is trying to backup every fifth close---as someone brand new to scripting (read: VERY new to this), it seems:

      a. The script isn't renaming the copy as directed, and....

      b. There should either be a step asking where I'd like to save the backup, or one that pre-determines where the backup goes...shouldn't there be? Or would that come naturally, after FM creates the copy?

      Your more experienced wisdom is deeply appreciated.

        • 1. Re: Auto-backup script error: "...could not be created on this disk."
          philmodjunk

          If you run the script directly from the script workspace (or manage | Scripts in older versions). Does it work?

          a) the script step does NOT add "copy" to the file name. It specifies that you are saving a copy of the file as opposed to a clone or compacted copy of the file.

          b) that would require a different script. This script saves a copy of the file back to the same folder where your database file is located as it does not specify a file path to some other location. If you current file is named "FM Receipts AutoBackup.fmp12", you'll get an error message as the OS will not allow you to save two files to the same folder with the same name.

          If you did not specify the file name in this script, you'd get a dialog where you could specify both the name of the back up copy and where to save the file.

          Hint: Save a Copy As, like most script steps, is both a menu option and a script step. The dialogs used will be the same or nearly the same for a given menu option/script step pair. So you can try doing something by manually selecting menu options and when it all works for you via manual methods, you can try your hand at listing the script step equivalents in the script in the same order as you used to manually select menu options.

          • 2. Re: Auto-backup script error: "...could not be created on this disk."
            Paper_Queen

            Not sure we're on the same track, PhilModJunk. In reading your response, here are my thoughts:

            a) the script step does NOT add "copy" to the file name

            If you current file is named "FM Receipts AutoBackup.fmp12", you'll get an error message as the OS will not allow you to save two files to the same folder with the same name.

            That wasn't my intent or expectation---thus, the Save a copy as step, renaming the backup "FM Receipts AutoBackup" (the original is named "Receipts"). 

            b) that would require a different script. This script saves a copy of the file back to the same folder where your database file is located as it does not specify a file path to some other location.

            I'm confused. What is the purpose of the Output file path setting (found when clicking the small gear that appears at the end of the "Save a copy" script line)? It allows me to set a file path, directing the copy to a specific folder on my desktop. 

            Sorry if these questions seem a bit off putting (not my intent), but reading your response has me even more stumped, appearing contrary to the FileMaker Help directions and wording of my script steps.

            • 3. Re: Auto-backup script error: "...could not be created on this disk."
              philmodjunk

              My initial statement was in response to exactly what you said, which indicated a misunderstanding about what save a copy does:

              since (a) the script includes a step that adds the word "Copy" to the file name;

              The "copy" parameter does not append "copy" to the file name. It specifies a specific kind of file copy action.

              With retards to file paths, I don't see that path specified in your script example, just a file name. When a file name is specified in the script step, it should be included in what is shown, but maybe FMP 14 does it differently. (And I did not know until this post that you were using FMP 14--it's always helpful to identify the version that you are using especially when a new version has just been released.

              So the possibility that you were saving to the same file name and location as your currently open file seemed possible and this would explain the error message that you are getting.

              And I just opened FMP 14 to do my own test and no, it does not show the file path as I had expected, just the file name. I couldn't recall if an error was returned if you saved a copy using a path/name that matched to an existing file (such as would happen the second time that you run this script). But my example worked without error and I was able to save a copy over and over with each copy replacing the previous.

              So I don't see why/how this would be failing for you. Try saving to the desktop and see if that works, there may be a folder permissions problem with your current folder (Sometimes OS based "write" permissions get messed up and need repair.)

              • 4. Re: Auto-backup script error: "...could not be created on this disk."
                Paper_Queen

                I was able to locate the problem. My script, as originally written, was perfect. The snag, as it turns out, was a corrected typo in the designated landing folder (two letters were reversed, then later corrected). Once the typo was addressed, the script ran like a charm.

                Sorry about not including which version of FMP I was using---my bad. It's FMP 14.