11 lines
273 B
Bash
11 lines
273 B
Bash
|
#!/bin/bash
|
||
|
#Script that manages backups by leca@foxarmy.org
|
||
|
|
||
|
#count every dir
|
||
|
count=$(find . -maxdepth 1 -type d -not -name "." | wc -l)
|
||
|
|
||
|
#if there are more than 5 directories, delete the oldest one.
|
||
|
if [ $count -gt 5 ]; then
|
||
|
rm -rf $(ls -d -t1 */ | tail -n 1)
|
||
|
fi
|