{"id":133,"date":"2021-01-28T15:29:23","date_gmt":"2021-01-28T14:29:23","guid":{"rendered":"https:\/\/www.mostlyharmless.nl\/?p=133"},"modified":"2021-01-28T15:35:58","modified_gmt":"2021-01-28T14:35:58","slug":"powershell-tips","status":"publish","type":"post","link":"https:\/\/www.mostlyharmless.nl\/index.php\/2021\/01\/28\/powershell-tips\/","title":{"rendered":"Powershell tips"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Get-ChildItem<br><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Using this you can get the file list from a directory. Gets the items and child items in one or more specified locations.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Get-ChildItem &#8220;&lt;path>&#8221; -Recurse -Filter <em>&lt;*.*<\/em>> | where {$_.LastWriteTime -le(Get-Date).AddDays(-&lt;amount of days>) }<br><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">that command can delete older files from a directory. can be useful when making backups<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Or get a list of files that were created today.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Get-ChildItem $source | where-object {$_.LastWriteTime -eq (Get-Date)}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Get-ChildItem Using this you can get the file list from a directory. Gets the items and child items in one or more specified locations. Get-ChildItem &#8220;&lt;path>&#8221; -Recurse -Filter &lt;*.*> | where {$_.LastWriteTime -le(Get-Date).AddDays(-&lt;amount of days>) } that command can delete older files from a directory. can be useful when making backups Or get a list&hellip; <a class=\"more-link\" href=\"https:\/\/www.mostlyharmless.nl\/index.php\/2021\/01\/28\/powershell-tips\/\">Lees verder <span class=\"screen-reader-text\">Powershell tips<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":138,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21,14,26,23],"tags":[],"class_list":["post-133","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-general-theory","category-ms","category-windows-administration","category-work-stuff","entry"],"_links":{"self":[{"href":"https:\/\/www.mostlyharmless.nl\/index.php\/wp-json\/wp\/v2\/posts\/133","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mostlyharmless.nl\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mostlyharmless.nl\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mostlyharmless.nl\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mostlyharmless.nl\/index.php\/wp-json\/wp\/v2\/comments?post=133"}],"version-history":[{"count":3,"href":"https:\/\/www.mostlyharmless.nl\/index.php\/wp-json\/wp\/v2\/posts\/133\/revisions"}],"predecessor-version":[{"id":139,"href":"https:\/\/www.mostlyharmless.nl\/index.php\/wp-json\/wp\/v2\/posts\/133\/revisions\/139"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.mostlyharmless.nl\/index.php\/wp-json\/wp\/v2\/media\/138"}],"wp:attachment":[{"href":"https:\/\/www.mostlyharmless.nl\/index.php\/wp-json\/wp\/v2\/media?parent=133"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mostlyharmless.nl\/index.php\/wp-json\/wp\/v2\/categories?post=133"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mostlyharmless.nl\/index.php\/wp-json\/wp\/v2\/tags?post=133"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}