But if it has files that are not yet deleted, why do you want to steal someone's wallet.
This is the tech board, not moral board. Who the legal owner is may depend on local laws. If you buy a hard drive, one could argue the data on it is your too. If someone is dumb enough to sell a disk with their private keys, they can assume someone is going to take it.
Now that I think about it: if I sell a hard drive, I'll leave some random data looking like private keys on there

That's evil

, especially when you could also download random wallet.dat from internet. Although OP's motivation give me more reason to write zeros on storage drive which i plan to sell or throw away.
You bought the HDD or it belongs to someone? What you bought suppose not to have non deleted files. But if it has files that are not yet deleted, why do you want to steal someone's wallet.
You can not have access to the wallet with the pubkey. No bitcoin private key that is long up to 90 characters.
If it is not your wallet, you do not need to make any effort to recover the wallet. You said you bought the HDD. If this is not a made up story, it is better you avoid malware.
Indeed i buy old HDDsevery saturday in the yard market for God knows since,when. Ihave houndreds of them in my garage. And i buy them for only one reason - in search of old abandoned wallets. Once i was lucky to find a wallet with 3 BTC back in time when it cost €3000/BTC, so all of my spendings (old HDDs cost not more than €5/pc), paied back. That is why i continue this "hobby". So now I've stumbled upon something that is not a wallet.dat and i can not figure out how to open it.
I'm curious about your "hobby". Do you only those HDD only to look abandoned wallet? Don't you use it for other hobby/task such as running BitTorrent/IPFS software or extra backup of certain data?