Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ArchivesMPath = "E:ArchivesBDDMensuelles"
- $SauvegardeMPath = "E:SauvegardeBDDMensuelle"
- $ArchivesQPath = "E:ArchivesBDDQuotidiennes"
- $SauvegardeQPath = "E:SauvegardeBDDQuotidienne"
- $DAYSOFWEEK = "Dimanche", "Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi"
- $MONTHS = "Decembre", "Janvier", "Fevrier", "Mars", "Avril", "Mai", "Juin", "Juillet", "Aout", "Septembre", "Octobre", "Novembre", "Decembre"
- $DAILYDIR = "$ArchivesQPath$($DAYSOFWEEK[(get-date).AddDays(-1).DayOfWeek.value__])"
- if ([System.IO.Directory]::Exists($DAILYDIR)){
- Remove-Item $DAILYDIR -Force -Recurse
- }
- New-Item -Path $DAILYDIR -ItemType directory
- Move-Item -Path "$SauvegardeQPath*" -Destination $DAILYDIR
- if ((get-date).AddDays(-1).day -eq 1){
- $MONTHLYDIR = "$ArchivesMPath$($MONTHS[(get-date).month])"
- if ([System.IO.Directory]::Exists($MONTHLYDIR)){
- Remove-Item $MONTHLYDIR -Force -Recurse
- }
- New-Item -Path $MONTHLYDIR -ItemType directory
- Move-Item -Path "$SauvegardeMPath*" -Destination $MONTHLYDIR
- }
Add Comment
Please, Sign In to add comment