by Tamino1230
A simple, global backup utility for Windows, written in C++. Includes a user-friendly installer and uninstaller for easy setup and removal.
The normal Installation Path is: c:\Users\<your-username>\AppData\Local\backup-setup\backup.exe
You need to have installed (from Visual Studio):
Visual Studio Community Edition or higher with the following components:
- Desktop development with C++
- MSVC v142 - VS 2019 C++ x64/x86 build tools
- Windows 10 SDK (10.0.18362.0)
Ensure these are selected during installation or added via the Visual Studio Installer.
backup remove-command
not implemented in Commandprompt/PowerShell yet. Please use setup.bat
.
xxx/
does not work in .backupignore
(not implemented)
- Create backups in
.backup/
directory - Global command-line usage:
backup init
,backup do
,backup auto --min X
- Remove all backups or just the command
- Menu-driven installer/uninstaller (
setup.bat
) - No admin rights required for backup usage (only for install/uninstall)
- Meta info:
backup init
creates a.backup/__init__
file with metadata (author, folder, timestamp, and init status) - Safety: All commands except
init
,meta
, andhelp
require initialization first
The .backupignore
file allows you to specify files and folders that should be excluded from backups. Place a .backupignore
file in the root of your project or backup directory. Each line in the file should specify a pattern, file, or folder to ignore.
NOTE: xxx/ DO NOT WORK BY NOW.
Example .backupignore
file:
# Ignore all log files
*.log
# Ignore the temp folder
temp/ (Not working currently)
# Ignore a specific file
secret.txt
Patterns follow standard glob rules. Lines starting with #
are treated as comments.
The backup utility includes a logging system to help track operations and diagnose issues. Logs are generated during key actions such as initialization, backup creation, and error handling.
-
Log Location:
Log files are typically stored in the.backup/
directory, often namedbackup.log
or similar. -
What Gets Logged:
- Timestamps for each operation
- Actions performed (e.g., backup started, backup completed, errors)
- Any warnings or errors encountered
- Metadata such as the user, folder, and backup status
-
How It Works:
The C++ code writes log entries using standard file I/O. Each log entry includes a timestamp and a description of the event. This helps users and developers review what happened during each backup session. -
Usage:
If you encounter issues or want to review backup activity, open the log file in the.backup/
directory. Reviewing logs can help identify problems or confirm successful operations.
File/Folder | Purpose |
---|---|
source/backup.cpp |
Main C++ source code for backup utility |
exe/backup.exe |
Compiled executable (gets used by setup.py) |
setup.bat |
Main menu-driven installer/uninstaller (recommended) |
.backup/ |
(Created by tool) Directory where backups are stored |
source/testscript.cpp |
Used for future Code |
.backupignore |
Specifies files/folders to exclude. |
Run setup.bat
and follow the menu prompts to install or uninstall the backup command and PowerShell alias.
setup.bat
Removed install.bat
and uninstall.bat
and got replaced with setup.bat
- setup.bat: Provides a menu to install or uninstall the backup command. Handles copying
backup.exe
, setting/removing the PowerShell alias, and updating the PATH. Shows a summary after each operation. - backup.exe: The actual backup tool. Use it from any CMD or PowerShell window after installation.
After installation, use the following commands globally in CMD or PowerShell:
Command | Description |
---|---|
backup init |
Initialize backup system |
backup do |
Create a backup |
backup auto --min X |
Run automatic backups every X mins |
backup remove --all |
Remove all backups |
backup remove-command |
Unregister the backup command |
backup meta |
Show backup meta information |
backup help |
Show available commands |
Note:
- You must run
backup init
before using any other command (exceptmeta
andhelp
).backup init
creates.backup/__init__
with metadata:init: True
, author, folder, and timestamp.backup meta
displays this metadata.
To build the backup tool from source:
-
Open the Project in Visual Studio:
- Launch Visual Studio.
- Go to File > Open > File... and select
source/backup.cpp
. - (Optional) Create a new empty C++ project and add
backup.cpp
to it for easier management.
-
Configure Build Settings:
- Set the project to use the C++17 standard (Project Properties > C/C++ > Language > C++ Language Standard > ISO C++17 Standard).
- Set the output directory to
exe\
(Project Properties > Configuration Properties > General > Output Directory).
-
Build the Executable:
- Press Ctrl+Shift+B or select Build > Build Solution.
- After building, ensure that
backup.exe
is created in theexe\
folder.
-
Move the Executable (if needed):
- If the executable is not in the
exe\
directory, manually move the builtbackup.exe
from the project's output folder (e.g.,Debug
orRelease
) to theexe\
directory at the root of your repository.
- If the executable is not in the
Tip: You can also use the Visual Studio Developer Command Prompt to build with
cl
, but using the Visual Studio IDE is recommended for easier configuration and error checking.
MIT License
Contact me on Discord: Tamino1230