SHARE
TWEET

Untitled

a guest Nov 8th, 2019 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #si le répertoir existe
  2. if (Test-Path $répertoire_cible) {
  3.    
  4.     $Date = (Get-Date).AddDays(-$Jours)
  5.  
  6.     # Prend la liste de fichier à archiver
  7.     $Recherche_Fichier = Get-ChildItem -Path $répertoire_cible\ -Include *.$TypeFichier | Where-Object {($_.Name -match $regex)} | Where-Object { $_.LastWriteTime -le $Date}
  8.    
  9.     #Affiche un message si aucun fichier
  10.     If (-not $Recherche_Fichier){Write-Host "Il n'y a pas de fichier a archiver"}
  11. }
  12.  
  13. # Archive les fichiers
  14. If ($Recherche_Fichier) {
  15.      
  16.     #met la date sur le dossier archiver
  17.     $TrouveDate = Get-Date -format dd.MM.yyyy-hh.mm
  18.     $NomArchive = "Sauvegarde_"+$TrouveDate
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top