Unable to delete files

heapdump716960.1416296627.txt  
heapdump716960.1416299494.txt    
heapdump716960.1416302375.txt   

trying to delete the above files

root@atec:/oratec/prodcomn/temp>rm heap*.*.txt
ksh: /usr/bin/rm: 0403-027 The parameter list is too long.

root@atec:/oratec/prodcomn/temp>rm heap*.txt
ksh: /usr/bin/rm: 0403-027 The parameter list is too long.

root@atec:/oratec/prodcomn/temp>rm heap*
ksh: /usr/bin/rm: 0403-027 The parameter list is too long.
root@atec:/oratec/prodcomn/temp>


Hello filosophizer,

It means there are too many files to fit (after parameter expansion) on the command line. Could you please try following.

find -type f -name "heapdump*.*txt" -print -exec rm {} \;

Thanks,
R. Singh

1 Like

Try

for i in heap*.*.txt; do
  rm "$i"
done

If there are no files in sub directories that should NOT be removed, you could try:

find . -type f -name 'heap*.*.txt' -exec rm {} +

which should be a lot faster..

1 Like