1
0
Fork 0

2024-04-30

This commit is contained in:
Gennadiy 2024-05-02 20:38:07 +03:00
parent 07b494aa75
commit e91d1096f6
4 changed files with 15 additions and 0 deletions

View file

@ -9,6 +9,7 @@
│ ├─ <a href='bash_scripts/README.en.md'>README.en.md</a>
│ ├─ <a href='bash_scripts/README.md'>README.md</a>
│ ├─ <a href='bash_scripts/archive_backup.sh'>archive_backup.sh</a>
│ ├─ <a href='bash_scripts/archive_cleanup.sh'>archive_cleanup.sh</a>
│ ├─ <a href='bash_scripts/archive_packages.sh'>archive_packages.sh</a>
│ ├─ <a href='bash_scripts/info_param.sh'>info_param.sh</a>
│ ├─ <a href='bash_scripts/info_references.sh'>info_references.sh</a>

View file

@ -5,6 +5,7 @@ Creating an archive, switching the domain, composing scripts and creating reposi
| № | Bash scripts | Actions performed |
|---|:-----------------------------------------------|:--------------------------------------------------------------------------------------------|
| 1 | [**archive_backup.sh**](archive_backup.sh) | Creating a common archive for the directories of projects on the current date. |
| | [archive_cleanup.sh](archive_cleanup.sh) | Deleting files and folders from the directories of projects before restoring the archive. |
| | [archive_packages.sh](archive_packages.sh) | Building websites, creating and copying archives for deployment. |
| 2 | [**info_param.sh**](info_param.sh) | Parameter for other scripts. Switching the domain of the remote repository. |
| | [info_references.sh](info_references.sh) | Updating the domain of a remote repository in cross-references in descriptions. |

View file

@ -5,6 +5,7 @@
| № | Скрипты Bash | Выполняемые действия |
|---|:-----------------------------------------------|:---------------------------------------------------------------------------------|
| 1 | [**archive_backup.sh**](archive_backup.sh) | Создание общего архива для каталогов проектов на текущую дату. |
| | [archive_cleanup.sh](archive_cleanup.sh) | Удаление файлов и папок из каталогов проектов перед восстановлением архива. |
| | [archive_packages.sh](archive_packages.sh) | Сборка вёб-сайтов, создание и копирование архивов для развёртывания. |
| 2 | [**info_param.sh**](info_param.sh) | Параметр для других скриптов. Переключение домена удалённого репозитория. |
| | [info_references.sh](info_references.sh) | Обновление домена удалённого репозитория в перекрёстных ссылках в описаниях. |

12
bash_scripts/archive_cleanup.sh Executable file
View file

@ -0,0 +1,12 @@
#!/bin/bash
echo "Удаление файлов и папок из каталогов проектов перед восстановлением архива."
echo "Отмена" && exit 0; # предохранитель
cd ..
# обходим все репозитории, расположенные на одном уровне с текущим
find .. -mindepth 1 -maxdepth 1 -type d | sort -r | while read -r dir; do
echo "Обработка: $dir"
# заходим в каталог, иначе пропускаем итерацию
cd "$dir" || continue
# удаляем вложенные файлы и папки кроме папок '.git' и '.idea'
find . -mindepth 1 -maxdepth 1 -type f,d -not -name '.git' -not -name '.idea' -print0 | xargs -0 rm -r
done