The solution I found is to replace the systime() command and use date +%s as follows:
for file in $(ls -ltr --time-style=+%s | awk '{cmd="date +%s"; cmd|getline now; close(cmd);del_time=now-30; if($6<del_time) print $7}') ;do rm -f $file >/dev/null 2>&1 done
The trick is to capture the output of date +%s inside awk , and using cmd="date +%s"; cmd|getline now; close(cmd) cmd="date +%s"; cmd|getline now; close(cmd) cmd="date +%s"; cmd|getline now; close(cmd) was the only (really first) way I found.
Edit: I changed the parenthesis backlinks as recommended by @Jotne
source share