Website with folder

Hi! I want to ask if I can host my website codes in a folder?
I fail to host my github pages on github inside folder.

Please be specific. Do you want to host your code using GitHub Pages so that others can download your code inside a folder, just like a program distribution? Or simply you want to just show your code through GitHub Pages site?

If you want others to download your code through GitHub Pages, just get the link of downloading a repo

then include that on your GitHub Pages, and say, download this code
or any other icon that is hyperlink of that address.

If you just want to display your code, then embedding it by back ticks is the answer, there are two versions:

embed 1 or the thre back ticks

embed 2

and since you are dealing with codes, you use the three backticks ```

or lastly if you want to display a folder-like system just like FTP, well, it’s really that hard through HTTP, through FTP, it’s really that simple but you will not use GitHub Pages for that.
What you can do is to have an icon representing a folder but it is a hyperlink then inside that contains icons also. You get the same appearance of folders within folders.

I mean I want to host all codes to website inside a specific folder only.

yes, that is exactly what you will do from a GitHub repo to GitHub Pages,

check this out,