Droptext.cc


Add-Type -AssemblyName System.IO.Compression.FileSystem

$results = @()
$target = [datetime]'2026-11-10'
$drives = Get-CimInstance Win32_LogicalDisk -Filter "DriveType=3" |
Select-Object -ExpandProperty DeviceID

foreach ($drive in $drives) {
Write-Host "Сканирую $drive ..." -ForegroundColor Cyan

Get-ChildItem "$drive\" -Filter *.xlsx -File -Recurse -Force -ErrorAction SilentlyContinue |
ForEach-Object {
$file = $_

try {
$zip = [System.IO.Compression.ZipFile]::OpenRead($file.FullName)

try {
$shared = @()
$entry = $zip.GetEntry("xl/sharedStrings.xml")

if ($entry) {
$reader = New-Object IO.StreamReader($entry.Open())
[xml]$xml = $reader.ReadToEnd()
$reader.Close()

$ns = New-Object Xml.XmlNamespaceManager($xml.NameTable)
$ns.AddNamespace("a", "http://schemas.openxmlformats.org/spreadsheetml/2006/main")

foreach ($item in $xml.SelectNodes("//a:si", $ns)) {
$shared += (($item.SelectNodes(".//a:t", $ns) |
ForEach-Object { $_.InnerText }) -join "")
}
}

foreach ($entry in $zip.Entries | Where-Object { $_.FullName -match '^xl/worksheets/sheet\d+\.xml$' }) {
$reader = New-Object IO.StreamReader($entry.Open())
[xml]$xml = $reader.ReadToEnd()
$reader.Close()

$ns = New-Object Xml.XmlNamespaceManager($xml.NameTable)
$ns.AddNamespace("a", "http://schemas.openxmlformats.org/spreadsheetml/2006/main")

foreach ($cell in $xml.SelectNodes("//a:c", $ns)) {
$v = $cell.SelectSingleNode("a:v", $ns)
if (!$v) { continue }

$value = $v.InnerText
$type = $cell.GetAttribute("t")

if ($type -eq "s" -and $value -match '^\d+$') {
$value = $shared[[int]$value]
}

$found = "$value" -match '(?<!\d)10[./-]11[./-]2026(?!\d)'

if (!$found -and $type -ne "s" -and $value -match '^\d+(\.\d+)?$') {
try {
$found = ([datetime]::FromOADate([double]$value).Date -eq $target)
} catch {}
}

if ($found) {
$results += [PSCustomObject]@{
File = $file.FullName
SheetXML = $entry.FullName
Cell = $cell.GetAttribute("r")
Value = $value
}
}
}
}
}
finally {
$zip.Dispose()
}
}
catch {
Write-Host "Пропущен файл: $($file.FullName)" -ForegroundColor Yellow
}
}
}

$results | Format-Table -AutoSize -Wrap
$results | Export-Csv "$env:USERPROFILE\Desktop\Found_Dates.csv" -NoTypeInformation -Encoding UTF8

Write-Host "ГОТОВО. Найдено совпадений: $($results.Count)" -ForegroundColor Green


Views: 3, posted on: 2026-11-10