{"id":132,"date":"2015-12-06T05:50:30","date_gmt":"2015-12-06T04:50:30","guid":{"rendered":"https:\/\/tollana.d-tor.org\/notes-to-self\/?p=132"},"modified":"2016-11-27T00:52:48","modified_gmt":"2016-11-26T23:52:48","slug":"powershell-and-square-brackets","status":"publish","type":"post","link":"https:\/\/tollana.d-tor.org\/notes-to-self\/?p=132","title":{"rendered":"Powershell and square brackets"},"content":{"rendered":"<p>Have you ever tried mass renaming files with square bracket in the path? Then I&#8217;m pretty sure you failed, because you can&#8217;t escape them easily. You have to do it manually by setting up temporary variables and replace &#8216;[]&#8217; by &#8216;&#8220;[&#8220;]&#8217;. \u00a0It&#8217;s a nightmare. Find a box with a bash shell or install <a href=\"http:\/\/www.cygwin.com\">cygwin<\/a>. Then simply do this:<\/p>\n<pre>$ for i in * ; do mv \"$i\" \"newname $i\" ; done<\/pre>\n<p>instead of\u00a0<a href=\"http:\/\/codepaq.blogspot.de\/2013\/08\/powershell-copy-files-that-contain.html\">this shit<\/a>! That makes PowerShell almost\u00a0useless for file operations \ud83d\ude41<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Have you ever tried mass renaming files with square bracket in the path? Then I&#8217;m pretty sure you failed, because you can&#8217;t escape them easily. You have to do it manually by setting up temporary variables and replace &#8216;[]&#8217; by &#8216;&#8220;[&#8220;]&#8217;. \u00a0It&#8217;s a nightmare. Find a box with a bash shell or install cygwin. Then &hellip; <a href=\"https:\/\/tollana.d-tor.org\/notes-to-self\/?p=132\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Powershell and square brackets<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[43],"tags":[46,87,45],"class_list":["post-132","post","type-post","status-publish","format-standard","hentry","category-windows","tag-powershell","tag-scripting","tag-windows"],"_links":{"self":[{"href":"https:\/\/tollana.d-tor.org\/notes-to-self\/index.php?rest_route=\/wp\/v2\/posts\/132","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tollana.d-tor.org\/notes-to-self\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tollana.d-tor.org\/notes-to-self\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tollana.d-tor.org\/notes-to-self\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tollana.d-tor.org\/notes-to-self\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=132"}],"version-history":[{"count":2,"href":"https:\/\/tollana.d-tor.org\/notes-to-self\/index.php?rest_route=\/wp\/v2\/posts\/132\/revisions"}],"predecessor-version":[{"id":134,"href":"https:\/\/tollana.d-tor.org\/notes-to-self\/index.php?rest_route=\/wp\/v2\/posts\/132\/revisions\/134"}],"wp:attachment":[{"href":"https:\/\/tollana.d-tor.org\/notes-to-self\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=132"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tollana.d-tor.org\/notes-to-self\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=132"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tollana.d-tor.org\/notes-to-self\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=132"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}