Skip to content

Instantly share code, notes, and snippets.

@zaheeraws
Created January 5, 2022 06:05
Show Gist options
  • Save zaheeraws/465ef64b81083f6bf2657185eb0bb95c to your computer and use it in GitHub Desktop.
Save zaheeraws/465ef64b81083f6bf2657185eb0bb95c to your computer and use it in GitHub Desktop.
#!/bin/bash
declare -a DIRS=("tmp" "video_clips" "video_thumbnails", "pdfs", "extracts", "coverage")
DAYS_TO_KEEP=3
BASE_PATH="/home/aviary/current"
BASE_PATH="/Users/mac/Documents/projects/aviary"
DIRS_LIST=${#DIRS[@]}
for (( i=0; i<${DIRS_LIST}; i++ ));
do
echo "${i} Removing Files under: ${BASE_PATH}/${DIRS[$i]}"
"find ${BASE_PATH}/${DIRS[$i]}/* -mtime +${DAYS_TO_KEEP} -exec rm {} \;"
wait
done
currentDate=`date`
echo "DONE @ $currentDate"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment