When you set the variables of your backup path. Make sure it's not in the If statement to check when the last backup was. Otherwise it doesn't get set correctly when you go through the delete backups loop if the last backup was less than 6 hours ago and it will delete files from the default directory opened.