This snippet fetches the list of files in a directory sorting them by their names using os.listdir(). Earlier we used glob() to do this.

Read more of this post