From ba5ad7f3a8b7e7854a473b4482c20943465a34e8 Mon Sep 17 00:00:00 2001 From: Vlado Date: Fri, 27 Mar 2026 07:14:05 +0100 Subject: [PATCH] notebookvb --- organize_erecept.ps1 | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 organize_erecept.ps1 diff --git a/organize_erecept.ps1 b/organize_erecept.ps1 new file mode 100644 index 0000000..61b1c31 --- /dev/null +++ b/organize_erecept.ps1 @@ -0,0 +1,31 @@ +# Organizace eRecept dokumentace do podsložek podle data +$sourceDir = "U:\Dropbox\!!!Days\Downloads Z230\eRecept" + +Get-ChildItem -Path $sourceDir -File | ForEach-Object { + $file = $_ + # Vyber datum ze začátku názvu souboru (formát YYYY-MM-DD) + if ($file.Name -match "^(\d{4}-\d{2}-\d{2})") { + $date = $matches[1] + $targetDir = Join-Path $sourceDir $date + + # Vytvoř složku pokud neexistuje + if (-not (Test-Path $targetDir)) { + New-Item -ItemType Directory -Path $targetDir | Out-Null + Write-Host "Vytvořena složka: $date" + } + + # ZIP soubory rozbal, ostatní přesuň + if ($file.Extension -eq ".zip") { + Write-Host "Rozbaluji: $($file.Name) -> $date\" + Expand-Archive -Path $file.FullName -DestinationPath $targetDir -Force + Remove-Item $file.FullName + } else { + Write-Host "Přesouvám: $($file.Name) -> $date\" + Move-Item -Path $file.FullName -Destination $targetDir -Force + } + } else { + Write-Host "Přeskakuji (bez data): $($file.Name)" + } +} + +Write-Host "`nHotovo!"