Today I open-sourced a utility I made for searching cluttered code bases (you know the kind - decrepit PHP collections with layer upon layer of cruft). It can help you find out how deep the rabbit hole goes.
I call it "Arkas the Code Hunter". http://github.com/beryllium/arkas
... It's written in PHP, even though it shouldn't be, but it has been very helpful in starting the conversion of a code base from raw file system access (including calls to unlink() directly) to using a file system abstraction library.
$ arkas unlink
Returns matching PHP lines with filename and line number, and each match is followed by the name of the class & method it occurred in. Then, you can take the name of the method and hunt for that:
$ arkas UnlinkTmpFiles
And you'll see all the places that invoke the direct FS access (all the failure points you need to test, in other words).
It might reveal the true maintenance nightmare of your code base, but by the same token, it will help you come up with a plan of attack for fixing it.