Skip to content

Commit

Permalink
Updated README for better instruction
Browse files Browse the repository at this point in the history
  • Loading branch information
angrychimp committed Aug 1, 2019
1 parent 2e22872 commit 5997ea3
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@
A Google Apps Script to purge Gmail messages by label

# HOW TO
1. Download the App Script (`AutoDeleteGmailByLabel.gs`) to your Google Drive folder. It
can go anywhere, but for simplicity's sake it can often be easiest just to put it
in the top level.
1. Go to https://script.google.com (make sure your profile is correct for personal or work email)

2. After you've downloaded the script, open the [Google Drive web UI](https://drive.google.com) and
double click on the script file to open it in the Apps Script editor.
2. Click the *New Script* button in the upper left.

3. Edit the `LABELS_TO_DELETE` list. You can use an asterisk (*) to match simple patterns for labels,
3. Copy and paste the code from [AutoDeleteGmailByLabel.gs](https://raw.githubusercontent.com/angrychimp/auto-delete-gmail-script/master/AutoDeleteGmailByLabel.gs)
into the new `Code.gs` editor provided for you. Then press `Ctrl+S` (or `Cmd+S`) to save.

4. For the "Project Name" enter "Auto-Delete-Gmail-by-Label". (This will create a `gscript` document in your Google Drive root folder.)

5. Edit the `LABELS_TO_DELETE` list. You can use an asterisk (*) to match simple patterns for labels,
and values for each entry should be the retention period in days. For example, to purge all
messages for all labels nested under "Archive" after 30 days, but keep messages under "Archive/Keep"
for up to 1 year, use the following example config:
Expand All @@ -22,7 +24,9 @@ var LABELS_TO_DELETE = {
(Note that the above will _not_ purge anything with just the "Archive" label, but it will specifically
look for anything _nested_ under "Archive".)

4. After adjusting the configuration, from the menu bar select "Run" -> "Run Function" -> "Install".
Once you've adjusted your label rules save the script.

6. After adjusting the configuration, from the menu bar select "Run" -> "Run Function" -> "Install".
This will schedule an initial run for the cleanup script 2 minutes from execution time, as well as
schedule a daily execution bewteen 1:00-2:00 AM in your local timezone.

Expand Down

0 comments on commit 5997ea3

Please sign in to comment.