This Bash script is designed to recursively search for .env
files starting from a specified directory and create a centralized backup structure for these files within a main backup directory called env-backup
.
-
Initial Setup:
- The script identifies the directory from which it is run (the current working directory) using the
pwd
command. - It creates a main backup directory named
env-backup
in this current directory. All individual backups will be contained within this directory.
- The script identifies the directory from which it is run (the current working directory) using the
-
Recursive Search:
- The script accepts a directory path as an argument. It starts searching from this specified directory and recursively finds all files named
.env
.