Suppress overwrite dialogue when backing up prefs from command line

I'm backing up DOpus preferences with a batch script that runs before my main backup app. The particular command for DOpus is:

"C:\Program Files\GPSoftware\Directory Opus\dopusrt.exe" /cmd Prefs Backup=all TO "C:\Users\xxx\Documents\backups\DOpus" QUIET/S

That works but every time I get a dialogue from DOpus asking if it's okay to overwrite the previous backup. I would like a way to suppress that and always overwrite, but there doesn't seem to be an option to do that anywhere.

1 Like

Why not make the batch file delete the old backup first?

It should also be QUIET not QUIET/S, to prevent the full Backup & Restore dialog opening.

Mainly because if you delete the backup file, you have one fewer backups. It's possible that the command might fail for some reason.

I suppose what is needed is a batch file that backs up to a new file, checks if it worked, and then overwrites the old one.

The ability to overwrite the backup file without the prompt/dialog is valuable because, as @mojo-chan noted, you don't want to first delete the file in case something goes wrong with the backup.

Even enhancing a batch script to "check if the backup was successful, then overwrite the old backup file" is sub-optimal and not fool-proof. For example, I use a continuous backup app for select files and folders. If I delete a file/folder, then I lose its change (backup) history; on the other hand, when I overwrite, the change (backup) history is maintained.

Please add an option to force the overwrite of the backup file.

An overwrite option would still have the same possibility.

If you want to keep the old backup until the new one is done, you can make your button create a temporary copy of it. Or just delete it to the recycle bin, so it's still there in the unlikely event that you need it.

In reality, config backups shouldn't fail unless something unusual is happening, in which case whatever that is should be fixed.

Agreed; however, in my particular case, with the continuous backup tool I use, deleting the existing backup file causes me to lose my change (backup) history.

As long as I overwrite the files included in my continuous backup selection criteria, even if the change results in them going down to zero bytes, the change (backup) history is maintained.

When I delete a file and then re-create it, its version history restarts at v1. This is, of course, intended functionality that I use from time to time when I want to get rid of a file's version/change/backup history; however, this is not the functionality I want when I'm merely updating/overwriting a file.

Overwriting a file is usually done by deleting the old file first. It usually just happens so fast you don’t notice. I doubt your backup tool cares, as if it did it would cause problems all over the place.

But you could always have the button/script make the backup to a new name, then copy it over the old one (which is going to delete the old one and rename the new one in its place: that’s how replacing files works).

But this is not technically true. Case in point: Then why would DOpus, for example, ask to confirm to replace the file since the file "doesn't" exist?

Opening a Word, Excel, text, etc., file, making updates, then saving (overwriting) it is not the same as deleting the file after opening it, making the edits, and then saving it back under its original name.

Continuous backup app in use or not, deleting a file causes it to go to the recycle bin (or not, if hard delete is used); updating/overwriting a file is not recycle-bin-based at all.

Going back to my use case, I specifically will not first delete the file because I want to maintain the change/backup history in my continuous backup app. The ask here is just to simply provide an option to suppress the popup dialog box prompt and to assume "yes, replace/overwrite" the file.

As a very simple and related example, look at the below for two parameters of the xcopy command. I use "/y" all the time because I don't want to be bothered with any prompts to overwrite a file and the ask here is the same: Provide a option to overwrite the backup file without prompting the user.

My solution was to create the backup to a new file, and then use the move command to overwrite the original. If the backup fails for some reason the move command fails as the source file is missing. I do it in a batch script.

It is in general. While you can open an existing file, truncate it, and then write new data into it, that's almost never done by most software, and it will result in both old and new data being lost if writing to the file fails for any reason.

Windows even has a ReplaceFile API for this purpose, and it will rename the old and new file and then delete the old file. (Although not everything uses ReplaceFile.)

Your backup software must handle that, or it'd go wrong with thousands of programs, including most text editors.

When does it do that?

When the Prefs command is executed to backup the settings. Here's the command I have in my button:

  • Prefs Backup=all to "Directory Opus Settings" QUIET

Note that I purposely removed the folder name for privacy reasons. The popup that appears is:


This is not a big issue for me because I am always in front of my computer when I do the backup and I always simply just click "Yes." However, it would be nice/convenient to add an option in the Prefs command that would simply bypass the popup and assume "Yes" was clicked.

The ask is truly simple: Just put an "if" statement before the popup. For example:

  • if overwriteOptionSpecified
         overwrite = "Yes";
         overwrite = popupPrompt("...Do you want to replace it?");

But that is only going to happen if there's already a backup with the same name. Delete (or rename or whatever) that backup first and you won't be prompted.

All clicking "Yes" in that dialog will do is delete the existing file before creating a new one. So if you make your auto-backup button delete the first, you get the same result without the prompt.