-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScanAnalysis.ps1
More file actions
32 lines (26 loc) · 1.11 KB
/
Copy pathScanAnalysis.ps1
File metadata and controls
32 lines (26 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# Укажите путь к папке с файлами
$folderPath = "C:\Users\chumi\Desktop\ZAPSCAN"
# Получаем все txt файлы в указанной папке
$files = Get-ChildItem -Path $folderPath -Filter *.txt
# Перебираем каждый файл
foreach ($file in $files) {
$content = Get-Content -Path $file.FullName
$newName = $file.Name
# Проверяем наличие слова "High" в файле
if ($content -match '\bHigh\b') {
$newName = "H" + $newName
}
# Проверяем наличие строки "PHP (VER)" в файле
if ($content -match "PHP \(7\.3\.33\)") {
$newName = "+" + $newName
}
# Добавьте другие условия по аналогии
# if ($content -match "AnotherPattern") {
# $newName = "AnotherPrefix" + $newName
# }
# Если имя файла изменилось, переименовываем файл
if ($newName -ne $file.Name) {
$newPath = Join-Path -Path $folderPath -ChildPath $newName
Rename-Item -Path $file.FullName -NewName $newPath
}
}