Link Search Menu Expand Document

Backup and Restore Files and Directories

Table of Contents

There are two ways to backup files in the Elastio CLI:

  • elastio stream backup
  • elastio file backup

The difference between these two methods is that the Elastio stream backup is used to backup files or streams of data, while the Elastio file backup is used to backup files and directories (folders). Let’s look at how to back up files and directories here and then move on to back up and restore streams in the next section.

Elastio file backup

The elastio file backup command is used to backup single or multiple files and/or folders.

Use the following command to back up a single file and folder:

elastio file backup <path-to-file>

or

elastio file backup <path-to-folder>

Use the following command to back up several files and folders:

elastio file backup <path-to-file-1> <path-to-file-2> <path-to-folder-1>  <path-to-folder-2>

Elastio file restore

The following commands can be used to restore files and folders from an Elastio backup or recovery point (RP).

Use the following command to restore all files and folders from the recovery point:

elastio file restore --rp <elastio-rp-id>

To restore a file from an RP with several files and folders and pipe it to .tar:

elastio file restore --rp <elastio-rp-id> <file-name> --target-file <target-file-path>

Save all recovery point contents to a .tar archive:

elastio file restore --rp <elastio-rp-id> --target-file=<target-file-path>

By default, the CLI restores the contents into a folder where the CLI is being run, --target-dir allows to override this behavior:

elastio file restore --rp <elastio-rp-id> --target-dir=<target-folder-path>

Restore only files that match the GLOB with the following command:

elastio file restore --rp <elastio-rp-id> --target-dir=<target-folder-path> --include "*mod*"

Restore only 1 file or folder from a recovery point with several items:

elastio file restore --rp <elastio-rp-id> --include "<file-name>"

Restore only files that do not match the GLOB with the following command:

elastio file restore --rp <elastio-rp-id> --target-dir=<target-folder-path> --exclude "*mod*"

Restore all files and folders from the recovery point except “file1”:

elastio file restore --rp <elastio-rp-id> --exclude "<filename>"