Snap Behavior for Key Operations
Following is a collection of state tables to depict the Snap's behavior for different configurations of the Source, Target and Error if exists properties. These combinations are applied to move, and copy operations. Use the following legend to understand what the values mean:
| Source | Target | Error if exists | |||
|---|---|---|---|---|---|
| -- | -- | x | State does not affect outcome | x | State does not affect outcome |
| 00 | Does not exist | 00 | Does not exist | 0 | Not selected |
| 01 | Regular file | 01 | Regular file | 1 | Selected |
| 10 | Directory | 10 | Empty directory | -- | -- |
| -- | -- | 11 | Non-empty directory | -- | -- |
FTP, SFTP, and File Protocols
| S. No. | Source | Target | Error if exists | Snap's Behavior | |
|---|---|---|---|---|---|
| Status | Description | ||||
| 1 | 00 | x | x | Error | Source not found. |
| 2 | 01 | 00 | x | Moved | -- |
| 3 | 01 | 01 | 0 | Moved | Target file is overwritten. |
| 4 | 01 | 01 | 1 | Error | Target already exists. |
| 5 | 01 | 10 | 0 | Moved | Empty target directory is replaced with a new file of the same name. |
| 6 | 01 | 10 | 1 | Error | Target already exists. |
| 7 | 01 | 11 | 0 | Error | Target directory not empty. |
| 8 | 01 | 11 | 1 | Error | Target already exists. |
| 9 | 10 | 00 | x | Moved |
-- Warning:
The source directory is renamed to the given target path if the target’s parent directory is not a subdirectory of the source. |
| 10 | 10 | 01 | 0 | Moved | Target file is removed and source directory is moved to the target directory. |
| 11 | 10 | 01 | 1 | Error | Target already exists. |
| 12 | 10 | 10 | 0 | Moved | Empty target directory is replaced with source directory. |
| 13 | 10 | 10 | 1 | Error | Target already exists. |
| 14 | 10 | 11 | 0 | Error | Target directory not empty. |
| 15 | 10 | 11 | 1 | Error | Target already exists. |
| S. No. | Source | Target | Error if exists | Snap's Behavior | |
|---|---|---|---|---|---|
| Status | Description | ||||
| 1 | 00 | x | x | Error | Source not found. |
| 2 | 01 | 00 | x | Copied | -- |
| 3 | 01 | 01 | 0 | Copied | Target file is overwritten. |
| 4 | 01 | 01 | 1 | Error | Target already exists. |
| 5 | 01 | 10 | 0 | Copied | Empty target directory is replaced with a new file of the same name. Warning: For some SFTP file servers, the Snap may produce an error with
the following Reason: "Cannot open output stream for <target path>" if the
Target property value ends with '/'. |
| 6 | 01 | 10 | 1 | Error | Target already exists. |
| 7 | 01 | 11 | 0 | Error | Target directory not empty. |
| 8 | 01 | 11 | 1 | Error | Target already exists. |
| 9 | 10 | 00 | x | Copied |
Empty target directory created. |
| 10 | 10 | 01 | 0 | Copied | Target file replaced with an empty directory of the same name. |
| 11 | 10 | 01 | 1 | Error | Target already exists. |
| 12 | 10 | 10 | 0 | No operation | Empty target directory remains the same. |
| 13 | 10 | 10 | 1 | Error | Target already exists. |
| 14 | 10 | 11 | 0 | Error | Target directory not empty. |
| 15 | 10 | 11 | 1 | Error | Target already exists. |
S3, WASB, and WASBS Protocols
| S. No. | Source | Target | Error if exists | Snap's Behavior | |
|---|---|---|---|---|---|
| Status | Description | ||||
| 1 | 00 | x | x | Error | Source not found. |
| 2 | 01 | 00 | x | Moved | -- |
| 3 | 01 | 01 | 0 | Moved | Target file is overwritten. |
| 4 | 01 | 01 | 1 | Error | Target already exists. |
| 5 | 01 | 10 | x | Moved | Source file is moved to the target directory. |
| 6 | 01 | 11 | 0 | Moved | Source file is moved to the target directory. |
| 7 | 01 | 11 | 1 | Moved or Error | Error if a file with the same name already exists in the target directory. |
| 8 | 10 | 00 | x | Moved | All files in the source directory are moved to the target directory. |
| 9 | 10 | 01 | 0 | Moved | A new target directory with a name same as the target file is created and all files in the source directory are moved to the target directory. As a result, a regular file and a directory with the same name will coexist in the target. |
| 10 | 10 | 01 | 1 | Error | Target already exists. |
| 11 | 10 | 10 | x | Moved | All files in the source directory are moved to the target directory. |
| 12 | 10 | 11 | 0 | Moved | All files in the source directory are moved to the target directory. |
| 13 | 10 | 11 | 1 | Moved or Error | Error if a file with the same name already exists in the target directory. |
| S. No. | Source | Target | Error if exists | Snap's Behaviour | |
|---|---|---|---|---|---|
| Status | Description | ||||
| 1 | 00 | x | x | Error | Source not found. |
| 2 | 01 | 00 | x | Copied | Target file is created. |
| 3 | 01 | 01 | 0 | Copied | Target file is overwritten. |
| 4 | 01 | 01 | 1 | Error | Target already exists. |
| 5 | 01 | 10 | x | Copied | Source file is copied to the target directory. |
| 6 | 01 | 11 | 0 | Copied | Source file is copied to the target directory. |
| 7 | 01 | 11 | 1 | Copied or Error | Error if the file of the same name exists in the target directory already. |
| 8 | 10 | 00 | x | Copied | All files in the source directory are copied to the target directory. |
| 9 | 10 | 01 | 0 | Copied | A new target directory with a name same as the target file is created and all files in the source directory are copied to the target directory. As a result, a regular file and a directory with the same name will coexist in the target. |
| 10 | 10 | 01 | 1 | Error | Target already exists. |
| 11 | 10 | 10 | x | Copied | All files in the source directory are copied to the target directory. |
| 12 | 10 | 11 | 0 | Copied | All files in the source directory are copied to the target directory. |
| 13 | 10 | 11 | 1 | Copied or Error | Error if the file of the same name exists in the target directory already. |