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 33 34 35 36 37 38 39 40 41 42
| ##
## Def variable
##
$date = Get-Date
$year = $date.year
$month = Get-Date -format "MM"
$day = $date.day
#"$day.$month.$year"
$directory = "F:\Exploitation\chemin\fichier\$year\$month\$day"
$file_u = "fichier_$year.$month.$day.*"
$log_deploy = "fichier_$year.$month.$day.*.7z"
$source = $directory
##
## script
##
cd $directory
if (!(Test-Path "deploy_$year.$month.$day.*")) {
Write-Output "Le dossier est absent"
Function Expand-Archive([string]$archive, [string]$source) {
$7z_Application = "D:\applicat\7-Zip\7z.exe"
$7z_Arguments = @(
'x' ## eXtract files with full paths
'-y' ## assume Yes on all queries
"`"-o$($source)`"" ## set Output directory
"`"$($archive)`"" ## <archive_name>
)
& $7z_Application $7z_Arguments
Write-Host "extract ok"
}
}
else{
Write-Output "Ok"
}
cd $file_u
Get-Content -Path F:\Exploitation\chemin\*.log | Select-String -Pattern mot1,'Fail' |
Partager