I have question why is my cmd for "removing all files in directory except last 20" not working within cron but in command prompt yes.
* * * * * ls -1tr /home/testusr/test | head -n -20 | xargs -d '\n' rm -f > /var/opt/check.log 2>&1
Directory contains let say 100x files which are named DATA-20140605xxxx generated minute by minute.
Thank advance for any answer.