Moved the global configuration to a seperate file.
Fixed the way the script extracts dates, script works again
Enabled the emptying of the logfile again
Fixed the loop for the old backups, it works again.