This article is an example of why making it easy for someone to code something they don't truly understand can be devestating in the long run. It is just as important if not more important to understand what a program is doing and exactly how it is doing that as it is to be able to easily write the program.
The fact that this code was simply taken and reused without anyone checking it before use is a huge oversight as well. Additionally, this code leaves it up to the operating system to sort files and in doing so destroys determinism and goes against some of the core principles of software engineering and science. This is why professional computer scientists should be incorporated into an study that uses computer added data analysis.