Hiding files except theme files in wordpress

Add below code at the bottom of your .htaccess file

Options -Indexes