When a "virus infects a file system or computer" that just means a virus has been executed on the computer, right?
No, using the word 'executes' here for a general description, is inaccurate. The Webopedia definition of 'execute is:
"(v.) Same as run, to perform an action, as in executing a program or a command."
For instance, Virut is a Polymorphic File Infector that infects ..
exe, .scr, .rar, .zip, .htm, .html.
It specifically uses exe or
executable files as a means of spreading their infection.
Some people use the term "caught a virus", relating a computer infection to a human one. Your original question was how does a virus know it's infected all the files. If you want a very general answer to that, and it would depend on the actual virus, I'd have to say if a virus causes enough files to become corrupt because of it's actions and the system crashes, there won't be any system left for it to work on!
If you do over the information on the site I left, you might better understand that the way a malware infection works will depend on what it was written to do. Some malware isn't going to harm files and folders on the host computer if it's a 'backdoor' to be used to either or both access the computer from the internet and to transmit from the computer to the internet.