Finally I found out most ASAP solution (ASAP -> As Simple As Possible).
Because name of directory I want to remove (and all its content) is a date of creation, because it is surveillance system. So using "date" command I can count number of days from 1970-01-01. If number of days is grater then 30 form today, just remove whole dir. The code below:
Code:
#!/bin/sh
#
ilosc_dni=30
#
katalog=/share/CACHEDEV2_DATA/kamery
FILES_Front_mp4=/share/CACHEDEV2_DATA/kamery/Kamery/Front/FI9900P_00626E660E5A/record
FILES_Front_jpg=/share/CACHEDEV2_DATA/kamery/Kamery/Front/FI9900P_00626E660E5A/snap
FILES_Bok_mp4=/share/CACHEDEV2_DATA/kamery/Kamery/Bok/FI9900P_00626E682B7A/record
FILES_Bok_jpg=/share/CACHEDEV2_DATA/kamery/Kamery/Bok/FI9900P_00626E682B7A/snap
#
#
x=`date +"%s"` ; actual=`echo $(( $x / 3600 / 24 ))`
for i in $FILES_Front_mp4 $FILES_Front_jpg $FILES_Bok_mp4 $FILES_Bok_jpg
do
for data in `find $i -maxdepth 1 -name '20*'|grep -o '.\{8\}$'`
do
x=`date -d $data +"%s"` ; curr=`echo $(( $x / 3600 / 24 ))`
dni=$((actual-curr))
[ $dni -gt $ilosc_dni ] && rm -rf $i/$data 2>/dev/null
done
done
Isnr it ASAP ?