{"id":64,"date":"2018-12-21T15:27:22","date_gmt":"2018-12-21T15:27:22","guid":{"rendered":"http:\/\/blog.bastosvictor.fr\/?p=64"},"modified":"2018-12-21T15:27:22","modified_gmt":"2018-12-21T15:27:22","slug":"supprimer-sauvegardes-de-plus-de-n-jours","status":"publish","type":"post","link":"http:\/\/blog.bastosvictor.fr\/index.php\/2018\/12\/21\/supprimer-sauvegardes-de-plus-de-n-jours\/","title":{"rendered":"Supprimer sauvegardes de plus de N jours"},"content":{"rendered":"<p>Windows &#8211; Powershell<\/p>\n<hr \/>\n<div>$dateASupprimer = (Get-Date).adddays(-7).ToString(&lsquo;yyyyMMdd&rsquo;)<\/div>\n<div>$cheminRepertoires = \u00ab\u00a0E:\\DATAS\\Sauvegardes\u00a0\u00bb<\/div>\n<div>$pathusers = gci $cheminRepertoires -name<\/div>\n<div>foreach($dir in $pathusers){<\/div>\n<div>$folder = \u00ab\u00a0$cheminRepertoires$dir\\$dateASupprimer\u00a0\u00bb<\/div>\n<div><\/div>\n<div>$Path = Test-Path $folder<\/div>\n<div>If ($Path -eq $True){<\/div>\n<div>\u00a0 \u00a0 \u00a0write-host \u00ab\u00a0$folder existe\u00a0\u00bb<\/div>\n<div>Remove-Item $folder -Recurse<\/div>\n<div>}<\/div>\n<div>}<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Windows &#8211; Powershell $dateASupprimer = (Get-Date).adddays(-7).ToString(&lsquo;yyyyMMdd&rsquo;) $cheminRepertoires = \u00ab\u00a0E:\\DATAS\\Sauvegardes\u00a0\u00bb $pathusers = gci $cheminRepertoires -name foreach($dir in $pathusers){ $folder = \u00ab\u00a0$cheminRepertoires$dir\\$dateASupprimer\u00a0\u00bb $Path = Test-Path $folder If ($Path -eq $True){ \u00a0 \u00a0 \u00a0write-host \u00ab\u00a0$folder existe\u00a0\u00bb Remove-Item $folder -Recurse } }<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"http:\/\/blog.bastosvictor.fr\/index.php\/wp-json\/wp\/v2\/posts\/64"}],"collection":[{"href":"http:\/\/blog.bastosvictor.fr\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.bastosvictor.fr\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.bastosvictor.fr\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.bastosvictor.fr\/index.php\/wp-json\/wp\/v2\/comments?post=64"}],"version-history":[{"count":1,"href":"http:\/\/blog.bastosvictor.fr\/index.php\/wp-json\/wp\/v2\/posts\/64\/revisions"}],"predecessor-version":[{"id":65,"href":"http:\/\/blog.bastosvictor.fr\/index.php\/wp-json\/wp\/v2\/posts\/64\/revisions\/65"}],"wp:attachment":[{"href":"http:\/\/blog.bastosvictor.fr\/index.php\/wp-json\/wp\/v2\/media?parent=64"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.bastosvictor.fr\/index.php\/wp-json\/wp\/v2\/categories?post=64"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.bastosvictor.fr\/index.php\/wp-json\/wp\/v2\/tags?post=64"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}