generated from ddev/ddev-addon-template
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtravel-mode
executable file
·40 lines (33 loc) · 1.35 KB
/
travel-mode
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env bash
#ddev-generated
## Description: Delete all DB dumps saved by "ddev pull". Since those dumps are unsanitized until they get imported to a database, it is best to delete them if you plan to leave EU soil.
## Usage: travel-mode
## Example: "ddev travel-mode"
# Prompt for the PROJECTS folder, default to one level up from the current project
GIT_ROOT=$(git rev-parse --show-toplevel)
DEFAULT_PATH=$(dirname "$GIT_ROOT")
read -p "Enter the path to the PROJECTS folder [default: $DEFAULT_PATH]: " PROJECTS
PROJECTS=${PROJECTS:-$DEFAULT_PATH}
PROJECTS=$(realpath "$PROJECTS")
# Check if the folder exists
if [ ! -d "$PROJECTS" ]; then
echo "The folder '$PROJECTS' does not exist. Exiting."
exit 1
fi
# Find files under .ddev/.downloads/*
echo "Listing files under .ddev/.downloads/ in $PROJECTS..."
find "$PROJECTS" -type f -path '*/.ddev/.downloads/*' -print
read -p "Type 'yes' to delete the files: " input
if [ "$input" == "yes" ]; then
echo "Deleting..."
find "$PROJECTS" -type f -path '*/.ddev/.downloads/*' -delete
echo "Deletion complete."
echo
echo "To fully remove all projects type:"
echo "ddev delete --all --clean-containers --omit-snapshot"
echo "to delete all DDEV projects and their databases."
echo "Pass -y if you don't want to be asked about every project"
else
echo "You did not type 'yes'. Exiting..."
exit 1
fi