Backing Up and Restoring Files/Folders

This article describes how you can use CloudBerry Backup CLI to back up and restore files/folders without saving the backup/restore configuration and creating a corresponding plan.

Back Up a File or Folder

Use the backup command to back up a file or a folder's contents to a required storage.

C:\Program Files\CloudBerryLab\CloudBerry Backup>cbb backup -?

Required Parameters

The following parameters are required to execute the backup command.

  • -a or -aid Specifies the name or ID of a storage account to where to upload your backup.
  • -f and/or -d Specifies the file or directory to back up.

The following example illustrates how to back up a file and a directory to the same backup storage.

cbb backup -a "account_name_or_ID" -f "C:\file.txt" -d "C:\BackupSource"

This command will upload only files that have been changed since the last backup date.

Optional Parameters

You can use the following parameters to specify additional options for your backup.

  • -s
    Enables a simple backup mode. This value should be set to "yes" or "no" (the default value).
    For example:
  cbb backup -a "account" -f "C:\file.txt" -s yes
  • -custom
    Enables a custom backup mode. When using this parameter, you need to specify a path to a custom folder in your backup storage. For example:
  cbb backup -a "account" -f "C:\file.txt" -custom "C:\CustomFolder"
  • -ifm or -efm
    Specifies a mask, indicating the files to include in the backup or exclude from it. For example:
  cbb backup -a "account" -d "C:\BackupSource" -ifm "*.exe; *.txt"

You can list multiple masks separated by a semicolon.

  • -skipf
    Specifies which folders to skip during backup processing. For example:
  cbb backup -a "account" -d "C:\Temp" -skipf "C:\Temp\Folder_1; C:\Temp\Folder_2"

You can list multiple folders separated by a semicolon.

  • -es
    Indicates whether or not to include system and hidden files in the backup. For example:
  cbb backup -a "account" -d "C:\BackupSource" -es yes
  • -bef
    Indicates whether or not to include empty folders in the backup. For example:
  cbb backup -a "account" -d "C:\BackupSource" -bef yes
  • -oa
    Indicates whether the backup should include only files that were modified after a specified date.
    For example:
  cbb backup -a "account" -d "C:\BackupSource" -oa "4/27/2018 3:12 PM"
  • -c
    Indicates whether or not to compress files in the backup. For example:
  cbb backup -a "account" -d "C:\BackupSource" -c yes

This can speed up uploading of your backup while it takes longer to process it before uploading.

  • -ea and -ep
    Encrypts the backup's contents using a specified algorithm (AES128, AES192 or AES256) and protects the backup with a password. For example:
  cbb backup -a "account" -d "C:\BackupSource" -ea "AES192" -ep "password"

When updating an existing file-level backup that was not previously encrypted, the encryption will only apply to the newly uploaded files.

  • -sse
    Enables server-side encryption of the backup's contents (if a storage provider supports this feature).
    For example:
  cbb backup -a "Amazon_S3_account" -d "C:\BackupSource" -sse yes
  • -sia
    When using an Amazon storage account, enables an S3 Standard-Infrequent Access storage class.
    For example:
  cbb backup -a "Amazon_S3_account" -d "C:\BackupSource" -sia yes
  • -vss
    Forces Volume Shadow Copy Service (VSS) that captures and copies stable images for backup on running systems without degrading the performance and stability of the services they provide. Use this option to force backing up of files that may be locked at the time of backup. For example:
  cbb backup -a "account" -d "C:\BackupSource" -vss yes

When this option is disabled, a backup service starts creating a shadow copy only after coming across a locked file. When this option is enabled, the backup service creates a shadow copy beforehand and does not attempt to backup locked files.

When using this feature, you can manually specify a custom VSS provider of your choice (see below).

Please consider the following limitations that apply to using this service:

  • VSS cannot be used to back up network files, such as network shares and mapped network drives.

  • VSS cannot make snapshots of data stored in FAT32-partitioned volumes.

  • -fastNtfs
    Enables you to speed up backup processing by using a low-level API to access NTFS structures when you need to back up a considerably large number of files that are stored on an NTFS-formatted device. For example:

  cbb backup -a "account" -d "C:\BackupSource" -fastNtfs yes

The resulting performance gain may vary depending on which storage device you are using and the number of files contained in your backup. While this gain may not be evident when running your backup plan for the first time, you should notice the difference when running subsequent differential backup.

  • -shareRw
    Enables using a shared read/write mode to overcome errors when attempting to back up files that are currently opened in other applications. For example:
  cbb backup -a "account" -d "C:\BackupSource" -shareRw yes

The following parameters define the standard output format for this command.

  • -json Send the status to stdout in a JSON format.
  • -xml Send the status to stdout in an XML format.
  • -output Specifies the output format: "short" or "full" (the default value).

Restore a File or Folder

Use the restore command to restore a file or a folder's contents from a specified backup storage.

C:\Program Files\CloudBerryLab\CloudBerry Backup>cbb restore -?

Required Parameters

The following parameters are required to execute the restore command.

  • -a (-account) Specifies the name or ID of a storage account from where to restore your backup.
  • -f (-file) and/or -d (-directory) Specifies the file or directory to restore.

The following example illustrates how to restore a file and a directory from the same backup storage.

cbb restore -account "account_name_or_ID" -file "C:\file.txt" -directory "C:\BackupSource"

Optional Parameters

You can use the following parameters to specify additional options when restoring your backup.

  • -bp
    Specifies the backup prefix. Use this parameter when restoring a backup made from another computer to specify that computer's name.

Please ensure that the specified backup prefix is correct. You can list backup prefixes available in a specified storage by executing the "cbb prefixes" command.

  • -rl (-location)
    Specifies the location to which to restore your files. Possible values: "original" (the default value) or a path to a custom location. For example:
  cbb restore -account "account" -file "C:\file.txt" -location "C:\Custom"

The backup service will create a directory specified as a custom location if this directory does not exist.

  • -rt (-restoreType)
    Specifies whether to restore a latest version of your file that is available in a specified backup storage at this moment, or a latest version available at a specific point in time. Possible values: "latest" (the default value) or a point in time.

CloudBerry backups include only files/folders that were modified since the previous backup date. As a result, selecting this option will restore only those file versions that were modified before the most recent backup and are not yet available in the destination folder.

For example, the following command restores the latest version of a file that is available in the backup storage at a specified point in time.

  cbb restore -account "account" -file "C:\file.txt" -restoreType "4/27/2018 3:00:00 PM"
  • -o (-overwrite)
    Indicates whether to overwrite all files in the destination folder for the restored backup, or restore only files that were never restored before. For example:
  cbb restore -account "account" -directory "C:\Temp" -overwrite
  • -rn (-restoreNew) Specifies whether to restore only newer file versions, or all files regardless of when they ware modified.
  • -ep (-encryptionPassword) Specifies the password to restore encrypted files/folders. These files will not be restored unless you have specified a valid encryption password.
  • -ntfs Indicates whether or not to restore NTFS permissions assigned to files stored in your backup.

The following parameters define the standard output format for this command.

  • -json Send the status to stdout in a JSON format.
  • -xml Send the status to stdout in an XML format.
  • -output Specifies the output format: "short" or "full" (the default value).

Delete Files/Folders from a Backup Storage {#section-delete-files}

Use the delete command to back up a file or a folder's contents to a required storage.

C:\Program Files\CloudBerryLab\CloudBerry Backup>cbb delete -?

Required Parameters

The following parameters are required to execute the delete command.

  • -a (-account) Specifies the name of a storage account from where you would like to delete files or folders.
  • -f (-file) and/or -d (-directory) Specifies the file or directory to delete.

The following parameter defines the standard output format for this command.

  • -output Specifies the output format: "short" or "full" (the default value).

Example

The following command deletes all versions of the specifies file and folder from a backup storage.

cbb delete -account "account" -file "C:\file.txt" -directory "C:\Backup"