{"id":9010,"date":"2026-05-30T14:20:17","date_gmt":"2026-05-30T12:20:17","guid":{"rendered":"https:\/\/mybox.com\/help\/?post_type=manual_kb&#038;p=9010"},"modified":"2026-05-30T14:20:18","modified_gmt":"2026-05-30T12:20:18","slug":"comenzi-ssh-rmdir","status":"publish","type":"manual_kb","link":"https:\/\/mybox.com\/help\/ro\/knowledgebase\/ssh-commands-rmdir\/","title":{"rendered":"Comenzi SSH \u2013 rmdir"},"content":{"rendered":"<div class=\"translation-block translation-block-merged\">\n<p class=\"wp-block-paragraph\">In server administration, file organization, and backend development, maintaining a clean filesystem structure requires regular cleanup of old or unused directory templates. The <strong><code>rmdir<\/code><\/strong> command stands for <strong>Remove Directory<\/strong>. It is a core POSIX-standard terminal utility designed for a single, highly specific task: deleting <strong>empty<\/strong> directories from your server&#8217;s filesystem.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Unlike destructive bulk deletion commands, <code>rmdir<\/code> features built-in safety constraints. It will refuse to delete any directory that contains files, hidden scripts, or nested folders, making it an excellent tool for safe ecosystem cleanup.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_86 ez-toc-wrap-left counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/mybox.com\/help\/ro\/knowledgebase\/ssh-commands-rmdir\/#Direct_Read_Operations_and_Primary_Command_Flags\" >Direct Read Operations and Primary Command Flags<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/mybox.com\/help\/ro\/knowledgebase\/ssh-commands-rmdir\/#1_Pruning_Empty_Parent_Trees_Automatically_rmdir_-p\" >1. Pruning Empty Parent Trees Automatically (rmdir -p)<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/mybox.com\/help\/ro\/knowledgebase\/ssh-commands-rmdir\/#2_Monitoring_Actions_with_Verbose_Mode_rmdir_-v\" >2. Monitoring Actions with Verbose Mode (rmdir -v)<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/mybox.com\/help\/ro\/knowledgebase\/ssh-commands-rmdir\/#Core_Safety_Constraints_and_Troubleshooting\" >Core Safety Constraints and Troubleshooting<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/mybox.com\/help\/ro\/knowledgebase\/ssh-commands-rmdir\/#The_%E2%80%9CDirectory_not_empty%E2%80%9D_Error\" >The &#8220;Directory not empty&#8221; Error<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/mybox.com\/help\/ro\/knowledgebase\/ssh-commands-rmdir\/#Working_with_Absolute_Brand_Directory_Paths\" >Working with Absolute Brand Directory Paths<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/mybox.com\/help\/ro\/knowledgebase\/ssh-commands-rmdir\/#Removing_a_Temporary_Directory_In-Place\" >Removing a Temporary Directory In-Place<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/mybox.com\/help\/ro\/knowledgebase\/ssh-commands-rmdir\/#Clearing_a_Staging_Branch_via_Absolute_Pathing\" >Clearing a Staging Branch via Absolute Pathing<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Direct_Read_Operations_and_Primary_Command_Flags\"><\/span>Direct Read Operations and Primary Command Flags<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<\/div>\n\n<div id=\"mybox-105076829\" class=\"mybox-content mybox-entity-placement\"><div class=\"early-access-banner-inpost\">\r\n  <div class=\"banner-left-inpost\">\r\n    <div class=\"icon-box-inpost\">\r\n      <img decoding=\"async\" src=\"https:\/\/mybox.com\/help\/wp-content\/uploads\/2026\/02\/square-info-icon.svg\" alt=\"Info\">\r\n    <\/div>\r\n    <div class=\"text-box-inpost\">\r\n      <span class=\"label-inpost\"><span class=\"translation-block translation-block-banner-text\">Acces timpuriu<\/span><\/span>\r\n      <h4><span class=\"translation-block translation-block-banner-text\">Mai ave\u021bi nevoie de ajutor?<\/span><\/h4>\r\n      <p><span class=\"translation-block translation-block-banner-text\">Contacta\u021bi echipa noastr\u0103 de servicii pentru clien\u021bi.<\/span><\/p>\r\n    <\/div>\r\n  <\/div>\r\n\r\n  <div class=\"banner-right-inpost\">\r\n    <a href=\"https:\/\/panel.mybox.com\/helpdesk2\/v\/list\/\" class=\"banner-button-inpost\"><span class=\"translation-block translation-block-banner-text\">Trimite mesaj<\/span><\/a>\r\n  <\/div>\r\n<\/div><\/div>\n\n<div class=\"translation-block translation-block-merged\"><p class=\"wp-block-paragraph\">The baseline syntax to delete a folder requires passing the command followed by the target folder name: <code>rmdir target_folder<\/code>. To clean up multi-tiered empty paths or monitor deletion tracks, you will regularly append these core operational flags:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"1_Pruning_Empty_Parent_Trees_Automatically_rmdir_-p\"><\/span>1. Pruning Empty Parent Trees Automatically (<code>rmdir -p<\/code>)<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">If you have a nested tree of empty folders (such as <code>old_assets\/templates\/images<\/code>), running a standard <code>rmdir<\/code> command on the top directory will fail because the folder technically contains subdirectories. The <code>-p<\/code> (parents) flag fixes this by working from the furthest nested folder backward, removing each directory along the path as long as they are completely empty.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>The Action:<\/strong> Pass the parent flag followed by your complete empty nested path string:Bash<code>rmdir -p old_assets\/templates\/images<\/code><\/li>\n\n\n\n<li><strong>Operational Benefit:<\/strong> This allows you to cleanly remove an entire empty subdirectory branch in a single step without having to navigate into each individual folder to delete them manually.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"2_Monitoring_Actions_with_Verbose_Mode_rmdir_-v\"><\/span>2. Monitoring Actions with Verbose Mode (<code>rmdir -v<\/code>)<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">By default, when <code>rmdir<\/code> executes successfully, the terminal deletes the folder silently and returns a fresh command line prompt. The <code>-v<\/code> (verbose) flag forces the server to output a live confirmation log detailing exactly which directory has been unlinked from the system.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>The Action:<\/strong> Combine verbose mode with the parent path tool to audit your cleanup process:Bash<code>mkdir -pv archive\/logs\/codes<\/code><\/li>\n\n\n\n<li><strong>The Output Returned:<\/strong> The terminal will print a clear step-by-step confirmation of its actions:Plaintext<code>rmdir: removing directory 'archive\/logs\/codes' rmdir: removing directory 'archive\/logs' rmdir: removing directory 'archive'<\/code><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Core_Safety_Constraints_and_Troubleshooting\"><\/span>Core Safety Constraints and Troubleshooting<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Because <code>rmdir<\/code> is built to prevent accidental data loss, you will occasionally encounter standard system error alerts when executing the command. Understanding these blocks ensures you handle your directory management safely.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"The_%E2%80%9CDirectory_not_empty%E2%80%9D_Error\"><\/span>The &#8220;Directory not empty&#8221; Error<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">If a folder contains even a single hidden file (such as an access configuration layer like <code>.htaccess<\/code> or an environment variable file like <code>.env<\/code>), the <code>rmdir<\/code> command will halt immediately and display an error message: <code>rmdir: failed to remove 'public_html': Directory not empty<\/code>.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>The Solution:<\/strong> To check for hidden assets preventing the deletion, run an all-inclusive list check on the folder: <code>ls -a public_html<\/code>. If the contents are no longer needed, you must remove the files first using the file deletion utility (<code>rm<\/code>) before running <code>rmdir<\/code> on the empty folder container.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Working_with_Absolute_Brand_Directory_Paths\"><\/span>Working with Absolute Brand Directory Paths<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">You can delete empty folder structures anywhere in your account workspace by passing absolute paths to the command line. When cleaning up projects inside your brand layout, make sure to map your directories cleanly from your account root:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Removing_a_Temporary_Directory_In-Place\"><\/span>Removing a Temporary Directory In-Place<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">To remove an old, empty testing directory from your active folder path, execute a direct relative path command:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Bash<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>rmdir public_html\/temp_assets\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Clearing_a_Staging_Branch_via_Absolute_Pathing\"><\/span>Clearing a Staging Branch via Absolute Pathing<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">To remove an obsolete, empty staging directory from an alternative domain project workspace within your brand environment, use explicit absolute targeting:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>rmdir -p \/home\/mybox\/yourlogin\/yourwebsite.com\/public_html\/old-staging\/css<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n<\/div>","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"template":"","format":"standard","manualknowledgebasecat":[54],"manual_kb_tag":[825,1180,6179,6181,6182,6183,6184,6185,6186,6187],"class_list":["post-9010","manual_kb","type-manual_kb","status-publish","format-standard","hentry","manualknowledgebasecat-ssh","manual_kb_tag-backend-development","manual_kb_tag-server-administration","manual_kb_tag-terminal-utility","manual_kb_tag-rmdir-command","manual_kb_tag-remove-directory","manual_kb_tag-remove-empty-directories","manual_kb_tag-empty-directories","manual_kb_tag-filesystem-cleanup","manual_kb_tag-directory-cleanup","manual_kb_tag-file-organization"],"_links":{"self":[{"href":"https:\/\/mybox.com\/help\/ro\/wp-json\/wp\/v2\/manual_kb\/9010","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mybox.com\/help\/ro\/wp-json\/wp\/v2\/manual_kb"}],"about":[{"href":"https:\/\/mybox.com\/help\/ro\/wp-json\/wp\/v2\/types\/manual_kb"}],"author":[{"embeddable":true,"href":"https:\/\/mybox.com\/help\/ro\/wp-json\/wp\/v2\/users\/1"}],"version-history":[{"count":1,"href":"https:\/\/mybox.com\/help\/ro\/wp-json\/wp\/v2\/manual_kb\/9010\/revisions"}],"predecessor-version":[{"id":9011,"href":"https:\/\/mybox.com\/help\/ro\/wp-json\/wp\/v2\/manual_kb\/9010\/revisions\/9011"}],"wp:attachment":[{"href":"https:\/\/mybox.com\/help\/ro\/wp-json\/wp\/v2\/media?parent=9010"}],"wp:term":[{"taxonomy":"manualknowledgebasecat","embeddable":true,"href":"https:\/\/mybox.com\/help\/ro\/wp-json\/wp\/v2\/manualknowledgebasecat?post=9010"},{"taxonomy":"manual_kb_tag","embeddable":true,"href":"https:\/\/mybox.com\/help\/ro\/wp-json\/wp\/v2\/manual_kb_tag?post=9010"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}