Avoid file conflict in rpm package

RPM will only remove files specified under "%files" directive, but only if there are no files under that directory. If you want "rpm -e" to remove all the files under "/etc/xyz/console" you will have to explicitly specify them under "%files"directive.

RPM does not delete anything it doesn't recognize on purpose as it is not safe, so you do not lose data just by removing the package, think about config files on the update for example. There is always an easy way to see what the RPM gets delivered with into the OS "rpm -qpl your_package.rpm" In your case there are 2 ways to have the files removed:

1) Specify them explicitly under "%files"

2) Or run "%postun" script where you remove your files and directories you intend.

Hope this helps.


%files    
/etc/xyz/console

%preun
if [ "$1" = 0 ] ; then
   rm -rf /etc/xyz/console/*
fi
exit 0

http://www.rpm.org/max-rpm/s1-rpm-inside-files-list-directives.html

EDIT after chat

rpm -qa --last | head

showed some old crufty package

rpm -e old_crufty

win.