Fixed several bugs

1- Files and folders were not properly ordered, used natcasesort to take into account upper and lower case in names.
2- Folder with dots in the names were presented as files. It's fixed.
3- Folders or files starting with dots were not showing. It's fixed.
4- Replaced a for to use foreach instead to simplify code.
5- Changed spaces to tabs for indentation and re-indented (sorry old habit)