16 lines
502 B
Bash
Executable file
16 lines
502 B
Bash
Executable file
#!/usr/bin/bash
|
|
#
|
|
# rename -exam directories in /home and /lmn/media older than 12h
|
|
# remove -exam.* directories in /home and /lmn/media older than 10d
|
|
#
|
|
|
|
set -eu
|
|
|
|
for dir in /home/ /lmn/media ; do
|
|
if [[ -d "${dir}" ]]; then
|
|
find "${dir}" -maxdepth 1 -mindepth 1 -name '*-exam' -type d -cmin +720 \
|
|
-exec bash -c 'mv "$0" "$0".$( date +%Y%m%d-%H%M --reference="$0" )' {} \;
|
|
find "${dir}" -maxdepth 1 -mindepth 1 -name '*-exam.*' -type d -cmin +14400 \
|
|
-exec rm -rf {} \;
|
|
fi
|
|
done
|