Improve loops #10
@ -50,7 +50,7 @@ get_xattr_of_file() {
|
||||
}
|
||||
|
||||
find_files_with_atime() {
|
||||
while read -r FILE; do
|
||||
find "${DIRECTORY}" -type f | while read -r FILE; do
|
||||
ATIME_FILE=$(get_atime_of_file "${FILE}")
|
||||
if [ "${ATIME_FILE}" == "" ]; then
|
||||
continue
|
||||
@ -58,12 +58,12 @@ find_files_with_atime() {
|
||||
if [ ${ATIME_FILE} -ge ${ATIME_SEARCH} ]; then
|
||||
echo "${FILE}"
|
||||
fi
|
||||
done <<< $(find "${DIRECTORY}" -type f)
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
find_files_with_retention() {
|
||||
while read -r FILE; do
|
||||
find "${DIRECTORY}" -type f | while read -r FILE; do
|
||||
RETENTION_FILE=$(get_xattr_of_file "${FILE}" "trusted.worm.attr" | grep -o '[0-9]\+$')
|
||||
if [ "${RETENTION_FILE}" == "" ]; then
|
||||
continue
|
||||
@ -72,12 +72,12 @@ find_files_with_retention() {
|
||||
if [ ${RETENTION_FILE} -eq ${RETENTION_SEARCH} ]; then
|
||||
echo "${FILE}"
|
||||
fi
|
||||
done <<< $(find "${DIRECTORY}" -type f)
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
set_atime() {
|
||||
for FILE in $(find_files_with_retention "${DIRECTORY}" "${RETENTION_SEARCH}"); do
|
||||
find_files_with_retention "${DIRECTORY}" "${RETENTION_SEARCH}" | while read -r FILE; do
|
||||
if [ -f "${FILE}" ]; then
|
||||
ARCHIVE_TIME=$(get_xattr_of_file "${FILE}" "trusted.archive_time")
|
||||
NEW_ATIME=$((ARCHIVE_TIME+NEW_RETENTION))
|
||||
@ -89,7 +89,7 @@ set_atime() {
|
||||
|
||||
|
||||
show_atime_retention() {
|
||||
while read -r FILE; do
|
||||
find "${DIRECTORY}" -type f | while read -r FILE; do
|
||||
ATIME=$(get_atime_of_file "${FILE}")
|
||||
if [ "${ATIME}" == "" ]; then
|
||||
continue
|
||||
@ -98,7 +98,7 @@ show_atime_retention() {
|
||||
echo "${FILE}"
|
||||
echo " atime: $(date --date=@${ATIME}) || ${ATIME}"
|
||||
echo " trusted.worm.attr: ${TRUSTED_WORM_ATTR}"
|
||||
done <<< $(find "${DIRECTORY}" -type f)
|
||||
done
|
||||
}
|
||||
|
||||
################################################################################
|
||||
|
||||
Loading…
Reference in New Issue
Block a user