I want to find all files in /usr/local which do not belong to an installed package as given by "pkg info" and have them automaticly removed. Offcourse no removal in /usr/local/etc.
[ I have had several core dumps off pkg when installing (bad/wrong) .txz manually so there might be stuff lying around ]
Maybe if I list all the files and then lookup for "the package providing file" and in absence "rm -f" ?
I come up with
[ I have had several core dumps off pkg when installing (bad/wrong) .txz manually so there might be stuff lying around ]
Maybe if I list all the files and then lookup for "the package providing file" and in absence "rm -f" ?
I come up with
Code:
find /usr/home 2> /dev/null | xargs -I {} pkg which {} | grep "not found" | grep -v etc | awk '{print $1}' | xargs -I {} rm -f {}