Skip to content

Commit

Permalink
apply suggestions from review
Browse files Browse the repository at this point in the history
  • Loading branch information
aaperis committed Mar 4, 2025
1 parent d928f91 commit 000fb34
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
18 changes: 12 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,25 +252,31 @@ exit without further processing.
- If a file has already been uploaded, the process will exit without further
processing. To overwrite existing files, use the `-force-overwrite` flag.

### Resume a multiple file upload
### Resume a multiple-file upload

It is possible to resume an interrupted upload from the last not uploaded file by adding the `-continue` flag which will prevent the `sda-cli` to return an error if a file is already uploaded on the target directory. For example:
Suppose you run the following command to upload two encrypted files,

```bash
./sda-cli -config <configuration_file> upload <encrypted_file_to_upload_1> <encrypted_file_to_upload_2>
```

After <encrypted_file_to_upload_1> has been uploaded, the process is interrupted while uploading <encrypted_file_to_upload_2>. To resume the upload, simply add the `-continue` flag to the command, as shown below:

```bash
./sda-cli -config <configuration_file> upload <encrypted_file_to_re-upload> <encrypted_file_to_upload> -continue
```

will skip `<encrypted_file_to_re-upload>` because it is already uploaded on the target directory and continue uploading `<encrypted_file_to_upload>`. Whereas:
The `-continue` flag is especially useful when recursively uploading an entire folder with encrypted files. For example, the following command:

```bash
./sda-cli -config <configuration_file> upload -r <folder_to_upload_with_unencrypted_data> -continue
./sda-cli -config <configuration_file> upload -r <folder_to_upload_with_encrypted_data> -continue
```

will skip uploading any files that are already uploaded to the target location and proceed with uploading the remaining files of `<folder_to_upload_with_unencrypted_data>`, effectively resuming the upload of the later in case this was previously interrupted.
will skip uploading any files that are already uploaded to the target location and proceed with uploading the remaining files of `<folder_to_upload_with_encrypted_data>`, effectively resuming the upload of the later in case this was previously interrupted.

Notes:

- `-continue` can be combined with any of the available flags except from `-force-overwrite`. In this scenario, the latter has precedence.
- `-continue` can be combined with any of the available flags except `-force-overwrite`. In this case, the latter takes precedence.
- `-continue` will not resume partially uploaded files. Any such file will be re-uploaded.

## List
Expand Down
4 changes: 2 additions & 2 deletions upload/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Options:
if already set in the config file or as the 'ACCESSTOKEN'
environment variable.
-continue Skip already uploaded files and continue with uploading the rest.
Useful for resuming an upload from the previous breakpoint.
Useful for resuming an upload from a previous breakpoint.
-encrypt-with-key <public-key-file>
Encrypt files using the specified public key before upload.
The key file may contain multiple concatenated public keys.
Expand Down Expand Up @@ -166,7 +166,7 @@ func uploadFiles(files, outFiles []string, targetDir string, config *helpers.Con
fileExists := len(listResult.Contents) > 0 && aws.StringValue(listResult.Contents[0].Key) == filepath.Clean(config.AccessKey+"/"+listPrefix)
switch {
case fileExists && *continueUpload:
fmt.Printf("File %s is already uploaded, continuing with next file...\n", filepath.Base(filename))
fmt.Printf("File %s has already been uploaded, continuing with the next file...\n", filepath.Base(filename))

continue
case fileExists && !*continueUpload:
Expand Down

0 comments on commit 000fb34

Please sign in to comment.