function getConfig ($configFile){
if (Test-Path ((Get-Location).Path + "\$configFile")){
$config = ([xml]$(Get-Content $configFile)).configuration
if ($? -and $config){
return $config
}
else{
Write-Host 'Config file is incorrect'
}
}
else {
Write-Host 'Config file not found'
}
}
function init {
$files = $configuration.logFiles.File
foreach ($file in $files){
New-Item -Path ($(Get-Location).Path + "\Logs\$(Get-Date -Format 'yyyy')\$(Get-Date -Format 'MM')\$(Get-Date -Format 'dd')") -Name $file.value -ItemType File -Force | Out-Null
}
}
$ErrorActionPreference = 'SilentlyContinue'
$configFile = 'config.xml'
$configuration = getConfig ($configFile)
init