Application icon

Handling File Exists in Copy Files, Create Symbolic Links and Move Statements

The Copy Files, Create Symbolic Links and Move statements have a runtime override setting for overide if file exists. When enabled, the File Exists Override named variable is examined. The contents of the named variable allow you to override the what to do if a file exists setting. The first of the following case insensitive codes, if any, is processed:

D
Force default handling.
S
Force Skip
R
Force Replace
B
Keep Both

If none of the above codes is encountered, nothing is changed.

The what to do if a file exists mode, is interpreted as follows:

Default
When running in immediate mode, you are presented with a panel which allows you to select Skip or Replace. If a rename template has been specified which has an (If Dup) token, you will also be presented with a Keep Both button. The presented panel has a Choose for all files checkbox, which you can select to retain your choice for subsequent files.

When running via the batch processor, if a rename template has been specified which has an (If Dup) token, the mode is equivalent to Keep Both, otherwise it is equivalent to Skip.

Skip
The files is skipped. ie. the operation does not take place.

Replace
The existing file is overwritten.

Keep Both
If a rename template has been specified which has an (If Dup) token, a duplicate file will be created. Otherwise, the following holds: If running in immediate mode, the mode is equivalent to Default. If running in the batch processor, the mode is equivalent to Skip.

When a panel is displayed in immediate mode, the Choose for all files checkbox only applies to the files being processed by the current statement. If you have multiple occurrences of these statements in an action you might want to preserve the user's intent for those subsequent statements.

For each of these statements, named variable File Exists User Always Choice is cleared. If the file exists prompt is issued and the user checks For all files, the results are stored to the named variable with an S for Skip, R for Replace or B for both. This methodology allows you to overide the subsequent statement's exists handling by enabling Runtime overide and setting named variable File Exists Override to the contents of named variable File Exists User Always Choice.

Example for a Move statements which may be called more than once:

1: Clear named variable 'File Exists Override'
2: ' .......
3: 
4: Start move loop
5: Move to \<path>/[template], runtime override(1)
6: Copy named variable 'File Exists User Always Choice' if not empty to named variable 'File Exists Override'

Line 1 clears the File Exists Override named variable so the first time the Move statement is executed, default will be assumed.

Line 5 moves the data and must enable Override If File Exists Handling.

Line 6 copies a user's choice, (if any), to File Exists Override so that it will be retained for subsequent passes through the move loop.