I have a script that read a file name from path location and then he takes only the numbers and do something with them. could be more than one file in the path
An example for file:
Patch_1348968.vip
Patch_1348968_v1.vip
Patch_1348968_v2.Zip
It takes the number 1348968.
The code that do that is:
$compressedfiles = Get-ChildItem -path $FilesPath\* -Include "*.vip", "*.zip", "*cab"
foreach ($file in $compressedfiles) {
$PatchNumber = ""
$PatchNumber = $file.Name -replace '.*[-_](\d+).*', '$1'
more code....
}
The goal is to ignore (continue to the next file) while the pattern is not as patch_######### An example to files I want to ignore: patch-8.6.22 (DA GUI CU + 1351661 + 1344344).zip
Any idea how to do it? Thanks