#!/bin/bash DATA_DEVICE_UUID="C6CE6C2BCE6C1649" MOUNT_PATH="/mnt/extern" DATA="${MOUNT_PATH}/timelapse" CLIENT="timelapse@192.168.111.2" CLIENT_FOLDER="/timelapse" mkdir -p "${DATA}/trash" #secs_last_day_of_last_month=`date -d "$(date +%Y-%m-01) -1 day" +%s` secs_last_day_of_last_month=`date -d "$(date +%Y-%m-01)" +%s` for i in `find ${DATA}/data/ -name "*.jpg"` do file_secs=`echo ${i} | cut -d"_" -f2 | cut -d"." -f1` if [ ${file_secs} -gt ${secs_last_day_of_last_month} ] then continue fi NUM_HARDLINKS=`stat --format="%h" ${i}` if [ ${NUM_HARDLINKS} -lt 2 ] then mv "${i}" "${DATA}/trash" fi done