How to use the command 'gyb' (with examples)
The ‘gyb’ command is a command line tool that allows users to locally back up their Gmail messages using Gmail’s API over HTTPS. This tool can estimate the number and size of all emails on a Gmail account, backup a Gmail account to a specific directory, backup only important or starred emails, and restore emails from a local folder to a Gmail account.
Use case 1: Estimate the number and size of all emails on your Gmail account
Code:
gyb --email email@gmail.com --action estimate
Motivation: Estimating the number and size of all emails on your Gmail account can provide you with important insights into the overall size of your mailbox. This can help you manage your storage space efficiently and make informed decisions on whether to delete or archive emails.
Explanation:
gyb
: The command line tool for locally backing up Gmail messages.--email email@gmail.com
: The email address associated with your Gmail account.--action estimate
: This flag tells the tool to estimate the number and size of all emails.
Example output:
Total number of emails: 2500
Total size of emails: 1.5 GB
Use case 2: Backup a Gmail account to a specific directory
Code:
gyb --email email@gmail.com --action backup --local-folder path/to/directory
Motivation: Backing up your Gmail account is important to ensure that you have a copy of all your emails in case of accidental deletion or loss. By specifying a specific directory, you can choose where to store the backup files, making it easier to organize and access them.
Explanation:
gyb
: The command line tool for locally backing up Gmail messages.--email email@gmail.com
: The email address associated with your Gmail account.--action backup
: This flag tells the tool to perform a backup of the Gmail account.--local-folder path/to/directory
: The directory where the backup files will be stored.
Example output:
Backup successfully created in path/to/directory.
Use case 3: Backup only important or starred emails from a Gmail account to the default local folder
Code:
gyb --email email@gmail.com --search "is:important OR is:starred"
Motivation: Backing up only important or starred emails can be useful when you want to prioritize specific emails for backup. This can help save storage space and ensure that you have a copy of the most crucial emails.
Explanation:
gyb
: The command line tool for locally backing up Gmail messages.--email email@gmail.com
: The email address associated with your Gmail account.--search "is:important OR is:starred"
: This flag tells the tool to search for and backup only emails that are marked as important or starred.
Example output:
Backup of important and starred emails successfully created in the default local folder.
Use case 4: Restore from a local folder to a Gmail account
Code:
gyb --email email@gmail.com --action restore --local-folder path/to/directory
Motivation: Restoring emails from a local folder to a Gmail account can be useful if you have previously backed up your emails and need to recover them. By specifying the local folder where the backup files are stored, you can easily restore the emails to your Gmail account.
Explanation:
gyb
: The command line tool for locally backing up Gmail messages.--email email@gmail.com
: The email address associated with your Gmail account.--action restore
: This flag tells the tool to restore emails from the local folder.--local-folder path/to/directory
: The directory where the backup files are stored.
Example output:
Restoration of emails from the local folder to the Gmail account email@gmail.com is completed.
Conclusion:
The ‘gyb’ command is a powerful tool for backing up and restoring Gmail messages. With its various use cases, users can estimate the number and size of their emails, perform backups to specific directories, back up only important or starred emails, and restore emails from local folders. This command provides users with control over their Gmail messages and helps ensure the safety and availability of important emails.