-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
69f6dbe
commit 1509ed9
Showing
1 changed file
with
18 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
|
||
|
||
|
||
# That is list the files of type directory whose name does not contain | ||
# a non-digit. So we only process automated deployments. | ||
# | ||
# Without LC_ALL=C, some find implementations, including GNU find could | ||
# also list files whose name contains sequences of bytes that don't form | ||
# valid characters in the current locale (like a répertoire encoded in | ||
# iso8859-1 (mkdir $'r\xe9pertoire') in a locale that uses UTF-8 as charset). | ||
DEPLOYMENTS=$(LC_ALL=C find . -maxdepth 1 ! -name '*[!0-9]*' -type d -printf '%p\n') | ||
|
||
|
||
for instance in $DEPLOYMENTS | ||
do | ||
find "$instance" -maxdepth 1 -mindepth 1 -type d -printf '%p\n' | sort -g | head -n -3 | xargs rm -rf | ||
done |