Small modification to createDirectory which makes this file works on macs. (If directory name has trailing / it is deleted before calling the perl command to create the directory)
Changed paths: