Accidentally created a folder containing a copy of itself and so on I have a folder MyProject. It's an Xcode project folder (not sure if relevant).

I am well aware that this folder is around 800MB. Recently I noticed that Get Info said that it was 17GB large.

I inspected the folder, and all the files were there just fine... and then I noticed that it contained another folder called MyProject. When I opened it, it was the exact same case: all the files were there, and there was another MyProject folder in it. And so on. That's right: Folderception.

I solved this by simply deleting the first duplicate MyProject in the chain.

However, I am curious, how could this have happened?

In order for it to copy itself enough times to yield 17GB, it would have to take quite a while - and I didn't even notice. But the more bizarre question is, what action could I have done to implicitly create a chain like this?
This is entirely possible to create by making a hard link to the parent directory using the terminal 'ln' command. The OS just won't know that MyProject inside of MyProject goes to the same place. It is curious how this may have happened, though.