Skip to content

Cloudundancy is a C++ command line program for quickly creating cloud-redundant and device-redundant backups of files.

License

Notifications You must be signed in to change notification settings

NeilJustice/Cloudundancy

Repository files navigation


Build Type Build Status
Clang 18 and GCC 13 on ubuntu-latest
VS2022 on windows-latest
GCC lcov code coverage

Cloudundancy is a C++23 command line program for quickly copying a configurable list of files and folders to a configurable list of destination folders to achieve cloud-redundant and device-redundant backups of files.

For example, on Windows in a Cloudundancy.ini file, destination folders can be configured to be automatic-cloud-uploading Google Drive and Microsoft OneDrive folders C:\GoogleDrive\CloudundancyBackups and C:\OneDrive\CloudundancyBackups. Double USB backups can also be achieved by adding USB drive paths such as E:\CloudundancyBackups and F:\CloudundancyBackups to a Cloudundancy.ini file.

On Linux, a Bash script can be written to run a Google Drive CLI command such as drive push from ~/googledrive after having run cloudundancy to copy files to ~/googledrive.

Cloudundancy command line usage

Cloudundancy v1.0.0

Usage:
   cloudundancy example-linux-ini-file
   cloudundancy example-windows-ini-file
   cloudundancy copy-files-to-multiple-folders
      --ini-file=<FilePath> [--delete-destination-folders-first]
   cloudundancy 7zip-files-then-copy-the-7zip-file-to-multiple-folders
      --ini-file-to-copy-files-to-7zip-staging-folder=<FilePath>
      --7zip-staging-folder=<FolderPath>
      --ini-file-to-copy-7zip-file-from-staging-folder-to-multiple-folders=<FilePath>

Cloudundancy program modes

example-linux-ini-file

Program mode example-linux-ini-file prints an example Linux Cloudundancy .ini file which shows how to achieve triple backups of files to one GitHub repo folder and two USB drives:

Example Linux Cloudundancy .ini file

example-windows-ini-file

Program mode example-windows-ini-file prints an example Windows Cloudundancy .ini file which shows how to achieve quintuple backups of files to two automatic cloud-uploading folders (C:\GoogleDrive and C:\OneDrive), one GitHub repo folder (C:\GitHubRepos), and two USB drives (D: and E:).

[DestinationFolders]
# Cloud-redundant backups to Google's cloud, Microsoft's cloud, and GitHub's cloud
C:\GoogleDrive\CloudundancyBackups
C:\OneDrive\CloudundancyBackups
C:\GitHubRepos\CloudundancyBackups

# Device-redundant backups to USB drive D: and USB drive E:
D:\CloudundancyBackups
E:\CloudundancyBackups

[SourceFilesAndFolders]
# In the [SourceFilesAndFolders] section, the line format is:
# SourceFileOrFolderPath -> RelativeDestinationFolderPath

# Critical files to backup
C:\CriticalFiles\KeePassFile.kdbx -> .
C:\CriticalFiles\PersonalFinancesSpreadsheet.xlsx -> .
C:\VS2022\Common7\IDE\VC\Snippets\1033\Visual C++\C++Snippets.snippet                              -> Snippets
C:\VS2022\Common7\IDE\Extensions\Microsoft\Python\Core\Snippets\1033\Python\PythonSnippets.snippet -> Snippets
C:\VS2022\VC#\Snippets\1033\Visual C#\CSharpSnippets.snippet                                       -> Snippets

# Critical folders to backup
# Source folder paths ending in a '\' or '/' character are interpretted as folders instead of files
C:\Users\UserName\Documents\WindowsPowerShell\ -> PowerShell

[FileSubpathsToNotCopy]
# In the [FileSubpathsToNotCopy] section, case-sensitive file path substrings can be listed one per line
# PowerShell Modules folder to not backup because PowerShell modules can be easily reinstalled
PowerShell\Modules\

copy-files-to-multiple-folders

cloudundancy copy-files-to-multiple-folders
   --ini-file=<CloudundancyIniFilePath> [--delete-destination-folders-first]

Program mode copy-files-to-multiple-folders copies files and folders listed in a Cloudundancy.ini file to multiple destination folders.

Most notably, destination folders can be configured to automatic cloud-uploading Google Drive and Microsoft OneDrive folders on Windows for achieving cloud-redundant file backups.

Console output on Linux for cloudundancy copy-files-to-multiple-folders --ini-file=/code/dotfiles/LinuxCloudundancy.ini --delete-destination-folders-first:

Linux copy-files-to-multiple-folders part 1

Linux copy-files-to-multiple-folders part 2

As an example on Windows, imagine the following folder structure at C:\CloudundancyTesting:

CloudundancyTesting Windows Explorer folder

With Cloudundancy.ini being as follows to instruct Cloudundancy to backup business-critical files and folders present in C:\CloudundancyTesting, except for file paths containing case-sensitive substrings ignored_filename or .ignored_file_extension:

CloudundancyTesting .ini file

Console output for Cloudundancy.exe copy-files-to-multiple-folders --ini-file=C:\CloudundancyTesting\Cloudundancy.ini --delete-destination-folders-first:

Windows copy-files-to-multiple-folders console out

Resulting contents of C:\CloudundancyTesting\GoogleDrive:

CloudundancyTesting GoogleDrive folder

Resulting contents of C:\CloudundancyTesting\OneDrive:

CloudundancyTesting OneDrive folder

Resulting contents of C:\CloudundancyTesting\GoogleDrive\Cloudundancy.log:

CloudundancyTesting GoogleDrive Cloudundancy.log

Resulting contents of C:\CloudundancyTesting\OneDrive\Cloudundancy.log:

CloudundancyTesting OneDrive Cloudundancy.log

7zip-files-then-copy-the-7zip-file-to-multiple-folders

cloudundancy 7zip-files-then-copy-the-7zip-file-to-multiple-folders
   --ini-file-to-copy-files-to-7zip-staging-folder=<CloudundancyIniFilePath>
   --7zip-staging-folder=<FolderPath>
   --ini-file-to-copy-7zip-file-from-staging-folder-to-multiple-folders=<CloudundancyIniFilePath>

Program mode 7zip-files-then-copy-the-7zip-file-to-multiple-folders performs the following steps to backup files to a .7z file and then copy the .7z file to multiple destination folders:

  1. Deletes the 7-Zip staging folder specified with --7zip-staging-folder.
  2. Copies [SourceFilesAndFolders] listed in Cloudundancy.ini file --ini-file-to-copy-files-to-7zip-staging-folder to the 7-Zip staging folder.

Example --ini-file-to-copy-files-to-7zip-staging-folder:

CodeFolderTo7ZipStagingFolderCopyingStep.ini

  1. Runs executable 7z on the PATH to 7-Zip the contents of --7zip-staging-folder to a .7z file written to folder <7ZipStagingFolder>\7ZipFile with file name CloudundancyBackup_YYYY-MM-DDTHH-MM-SS.7z.
  2. Copies the .7z file to [DestinationFolders] listed in Cloudundancy.ini file --ini-file-to-copy-7zip-file-from-staging-folder-to-multiple-folders.

Example --ini-file-to-copy-7zip-file-from-staging-folder-to-multiple-folders:

7ZipFileToGoogleDriveAndOneDriveCopyingStep.ini

As an example, consider the following folder structure:

Cloudundancy 7-Zip testing folder

Console output on Windows for the following Cloudundancy 7-zip command line:

Cloudundancy.exe 7zip-files-then-copy-the-7zip-file-to-multiple-folders
   --ini-file-to-copy-files-to-7zip-staging-folder=C:\Cloudundancy7ZipTesting\CodeFolderTo7ZipStagingFolderCopyingStep.ini
   --7zip-staging-folder=C:\Cloudundancy7ZipTesting\7ZipStagingFolder
   --ini-file-to-copy-7zip-file-from-staging-folder-to-multiple-folders=C:\Cloudundancy7ZipTesting\7ZipFileToGoogleDriveAndOneDriveCopyingStep.ini

7-Zip mode standard output

GitHub repos successfully 7-Zipped and copied to a Google Drive folder:

Google Drive .7z file

Google Drive .7z file contents

GitHub repos successfully 7-Zipped and copied to a OneDrive folder:

One Drive .7z file

One Drive .7z file contents

Steps to build binary cloudundancy on Linux with Clang

git clone https://github.com/NeilJustice/Cloudundancy
cd Cloudundancy && mkdir Release && cd Release
CXX=clang++ cmake .. -DCMAKE_BUILD_TYPE=Release
sudo cmake --build . --target install

Steps to build executable Cloudundancy.exe on Windows with Visual Studio 2022

git clone https://github.com/NeilJustice/Cloudundancy
cd Cloudundancy
cmake . -G"Visual Studio 17 2022" -A x64 -DCMAKE_INSTALL_PREFIX=C:\bin
cmake --build . --config Release --target install

Thanks to

brandmark.io for Cloudundancy's logo

About

Cloudundancy is a C++ command line program for quickly creating cloud-redundant and device-redundant backups of files.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •