Apple has acknowledged that, in some cases, iTunes can delete music files. In a statement made to The Loop, Apple said:
In an extremely small number of cases users have reported that music files saved on their computer were removed without their permission. We’re taking these reports seriously as we know how important music is to our customers and our teams are focused on identifying the cause. We have not been able to reproduce this issue, however, we’re releasing an update to iTunes early next week which includes additional safeguards. If a user experiences this issue they should contact AppleCare.
It’s not clear what’s happening, but it is clear that Apple doesn’t know what’s going on. This statement is certainly a reaction to a recent story about a user who claimed that Apple Music deleted his music files. It’s not Apple Music, as I pointed out, but it’s not clear what happened.
I’m not sure what Apple can do to add “additional safeguards” to iTunes. There have been a number of cases where an app or an installer have deleted important files, one of the most recent being an Adobe Creative Cloud updater that deleted certain items. An app or installer malfunctioning can easily delete files.
iTunes is essentially a database, but also a file manager. It can move and delete files when you tell it to. It sounds like, here, something is happening in iTunes that is causing file deletion. And a bug like this is hard to find; it involves a lot of trial and error, detailed logging, and testing over and over to try and reproduce it.
Yet again, this underscores the need to have a backup of your data. Or two. Or three. Because you never know.
If you think iTunes has deleted some of your files, and you have Time Machine backups, you can use this method look through your Time Machine backups to see what may have been deleted.