Create a .htaccess file by opening a new text document using notepad and saving it as “.htaccess”. must include the quotation marks so that notepad won’t give it an extension of .txt automatically. Or you can create a .txt file and rename it to .htacess

Add this words to your txt document.

Options -Indexes.

Then save.

And upload it to the directory you want to restrict listing.

This will prevent user from seeing all files on your web server directory.