Ok I have requested a code here but initial I didn't ask to make it busybox compatible. My bad. I'm new to Linux and coding.
The code needs to do the following:
Delete 50GB of oldest data (dir with files) from a directory when the HD reaches a capacity of 95%.
The code they gave me is, that is not working with busybox:
DIRS="a/ b/" MAXDELBYTES="53687091200" # 50GB DELBYTES="0" find $DIRS -type f -printf "%T@ %s %p\n" | sort -r -n | while read time bytes filename do rm -fv "$filename" DELBYTES=$((DELBYTES + bytes)) if [ $DELBYTES -ge $MAXDELBYTES ]; then break; fi done
What is not working:
- -printf (changed it to -print)
- %T@ %s %p\n (don't know what to change it to)
- Do not know what else isn't working. I'm new to coding and Linux.
Now this need to be translated to busybox so it will work on my embedded Linux system. Also a cron command needs to be added so it runs every Friday.