{"id":1597,"date":"2012-12-19T15:17:03","date_gmt":"2012-12-19T15:17:03","guid":{"rendered":"http:\/\/www.edwardsd.co.uk\/work\/?p=1597"},"modified":"2023-09-17T23:01:48","modified_gmt":"2023-09-17T22:01:48","slug":"delete-folderfiles-via-command-line","status":"publish","type":"post","link":"https:\/\/www.edwardsd.co.uk\/work\/2012\/12\/delete-folderfiles-via-command-line\/","title":{"rendered":"Delete folder\/files | CL"},"content":{"rendered":"<p><strong>Methods to delete files via command line:<\/strong> <strong>Normally I take ownership of the folder\/files (<a title=\"Takeown\" href=\"http:\/\/technet.microsoft.com\/en-us\/library\/cc753024(v=ws.10).aspx\" target=\"_blank\" rel=\"noopener\">takeown<\/a>):<\/strong><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">takeown \/f&amp;nbsp;c:\\folder\\location&amp;nbsp;\/r \/d y<\/pre>\n<ul>\n<li>\/r&nbsp;Performs a recursive operation on all files\/folders.<\/li>\n<li>\/d&nbsp;Suppresses the confirmation prompt.<\/li>\n<li>y&nbsp;Yes Take ownership of the directory.<\/li>\n<\/ul>\n<p><strong>Change Permission (<a title=\"icacls\" href=\"http:\/\/technet.microsoft.com\/en-us\/library\/cc753525(v=WS.10)\" target=\"_blank\" rel=\"noopener\">icacls<\/a>):<\/strong><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">icacls c:\\folder\\location&amp;nbsp;\/grant administrators:F \/t<\/pre>\n<ul>\n<li>\/t&nbsp;Performs a recursive operation on all files\/folders.<\/li>\n<\/ul>\n<p><strong>Delete Process (del):&nbsp;<\/strong><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">del c:\\folder\\location\\*.*&amp;nbsp;\/s \/q<\/pre>\n<ul>\n<li>\/q Quiet mode, do not ask if ok to delete on global wildcard<\/li>\n<li>\/s&nbsp;Delete specified files from all sub-directories (DELTREE).<\/li>\n<li>\/f&nbsp;Force deleting of read-only files.<\/li>\n<\/ul>\n<p><strong>Delete Process&nbsp;(RD):<\/strong><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">RD \/S \/Q c:\\folder\\location\\<\/pre>\n<ul>\n<li>\/q Quiet mode, do not ask if OK to delete on global wildcard<\/li>\n<li>\/s&nbsp;Delete specified files from all sub-directories.<\/li>\n<\/ul>\n<p><strong>Example using RD to remove a troublesome files that just wouldn&#8217;t delete:<\/strong><\/p>\nngg_shortcode_0_placeholder\n","protected":false},"excerpt":{"rendered":"<p>Methods to delete files via command line: Normally I take ownership of the folder\/files (takeown): takeown \/f&amp;nbsp;c:\\folder\\location&amp;nbsp;\/r \/d y \/r&nbsp;Performs a recursive operation on all files\/folders. \/d&nbsp;Suppresses the confirmation prompt. y&nbsp;Yes Take ownership of the directory. Change Permission (icacls): icacls c:\\folder\\location&amp;nbsp;\/grant administrators:F \/t \/t&nbsp;Performs a recursive operation on all files\/folders. Delete Process (del):&nbsp; del c:\\folder\\location\\*.*&amp;nbsp;\/s [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[6,21,23],"tags":[],"class_list":["post-1597","post","type-post","status-publish","format-standard","hentry","category-bat","category-code","category-windows-server-2008"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pOPt8-pL","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.edwardsd.co.uk\/work\/wp-json\/wp\/v2\/posts\/1597","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.edwardsd.co.uk\/work\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.edwardsd.co.uk\/work\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.edwardsd.co.uk\/work\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.edwardsd.co.uk\/work\/wp-json\/wp\/v2\/comments?post=1597"}],"version-history":[{"count":3,"href":"https:\/\/www.edwardsd.co.uk\/work\/wp-json\/wp\/v2\/posts\/1597\/revisions"}],"predecessor-version":[{"id":3852,"href":"https:\/\/www.edwardsd.co.uk\/work\/wp-json\/wp\/v2\/posts\/1597\/revisions\/3852"}],"wp:attachment":[{"href":"https:\/\/www.edwardsd.co.uk\/work\/wp-json\/wp\/v2\/media?parent=1597"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.edwardsd.co.uk\/work\/wp-json\/wp\/v2\/categories?post=1597"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.edwardsd.co.uk\/work\/wp-json\/wp\/v2\/tags?post=1597"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}