Guest User

Untitled

a guest
Jun 13th, 2018
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. $ArchivesMPath = "E:ArchivesBDDMensuelles"
  2. $SauvegardeMPath = "E:SauvegardeBDDMensuelle"
  3. $ArchivesQPath = "E:ArchivesBDDQuotidiennes"
  4. $SauvegardeQPath = "E:SauvegardeBDDQuotidienne"
  5. $DAYSOFWEEK = "Dimanche", "Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi"
  6. $MONTHS = "Decembre", "Janvier", "Fevrier", "Mars", "Avril", "Mai", "Juin", "Juillet", "Aout", "Septembre", "Octobre", "Novembre", "Decembre"
  7.  
  8. $DAILYDIR = "$ArchivesQPath$($DAYSOFWEEK[(get-date).AddDays(-1).DayOfWeek.value__])"
  9. if ([System.IO.Directory]::Exists($DAILYDIR)){
  10. Remove-Item $DAILYDIR -Force -Recurse
  11. }
  12. New-Item -Path $DAILYDIR -ItemType directory
  13. Move-Item -Path "$SauvegardeQPath*" -Destination $DAILYDIR
  14.  
  15. if ((get-date).AddDays(-1).day -eq 1){
  16. $MONTHLYDIR = "$ArchivesMPath$($MONTHS[(get-date).month])"
  17. if ([System.IO.Directory]::Exists($MONTHLYDIR)){
  18. Remove-Item $MONTHLYDIR -Force -Recurse
  19. }
  20. New-Item -Path $MONTHLYDIR -ItemType directory
  21. Move-Item -Path "$SauvegardeMPath*" -Destination $MONTHLYDIR
  22. }
Add Comment
Please, Sign In to add comment