Useful: No. Secure: No.
The most pertinent part of your question is the title which I'd slightly correct to "Key generation algorithm based on file lengths in a drive". It is here at the start that you've made invalid assumptions. There are others later on too though.
A random cryptographic key is essentially entropy, which you can read as uncertainty. So from a high level, key = entropy = uncertainty. The file structure on a typical machine is fairly well specified, whether it's a proper *nix machine or one of those other ones. If the machine is newly created (especially as a virtual image or embedded), the file layout may be identical between machine instances. So any key derived from the file system (lengths or contents thereof) will be highly predicable. There for insecure. You have confused complexity with uncertainty. The file system is certainly complex, but think of all of those free AOL CDs that ended up as coasters. If you had run your algorithm across the newly installed AOL directory, all of the generated keys would be identical across any machine you'd just installed on. All of you 10 million digit concatenations would have been identical, or very nearly identical.
The second error is the key length. As a security student, you'll come across typical acceptable key sizes. No one will even require more than 256 bits of key security. There are mathematical proofs of this limit. Your attempt at creating an extra long key is meaningless. A lot of cryptographic primitives are designed around the 256 bit size. What were you attempting to use a 10 million byte key for, as there is no legitimate function to absorb such a key? [You're not thinking one time pad are you?]
With respect, you're probably quite new to cryptography on the basis of this question. There is no effective improvement that can be made to this algorithm without a much more extensive understanding of the nature of a cryptographic key and it's relationship to entropy.
You are though ultimately correct in realising that a key can be generated from the chaotic churn inside a modern computer environment. Chaos principles can be applied to a file system and there is true entropy but it requires a much greater understanding of the principles before you can extract it safely.
/urandom/
... $\endgroup$