{"id":9747,"date":"2026-06-03T10:01:43","date_gmt":"2026-06-03T08:01:43","guid":{"rendered":"https:\/\/mybox.com\/help\/?post_type=manual_kb&#038;p=9747"},"modified":"2026-06-03T10:01:44","modified_gmt":"2026-06-03T08:01:44","slug":"cum-sa-verificati-numarul-de-fisiere-dintr-un-director-selectat-si-din-subdirectoarele-acestuia","status":"publish","type":"manual_kb","link":"https:\/\/mybox.com\/help\/ro\/knowledgebase\/how-to-check-the-number-of-files-in-a-selected-directory-and-its-subdirectories\/","title":{"rendered":"Cum s\u0103 verifica\u021bi num\u0103rul de fi\u0219iere dintr-un director selectat \u0219i din subdirectoarele acestuia"},"content":{"rendered":"<div class=\"translation-block translation-block-merged\">\n<p class=\"wp-block-paragraph\">If you want to determine which directory contains the largest number of files, you can use a command that counts files and directories within the current location and its immediate subdirectories.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This can be particularly useful when troubleshooting high inode usage, identifying directories containing large numbers of files, or locating applications that generate excessive temporary data.<\/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\/how-to-check-the-number-of-files-in-a-selected-directory-and-its-subdirectories\/#Prerequisites\" >Prerequisites<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/mybox.com\/help\/ro\/knowledgebase\/how-to-check-the-number-of-files-in-a-selected-directory-and-its-subdirectories\/#Command\" >Command<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/mybox.com\/help\/ro\/knowledgebase\/how-to-check-the-number-of-files-in-a-selected-directory-and-its-subdirectories\/#Example_Output\" >Example Output<\/a><\/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\/how-to-check-the-number-of-files-in-a-selected-directory-and-its-subdirectories\/#Understanding_the_Results\" >Understanding the Results<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/mybox.com\/help\/ro\/knowledgebase\/how-to-check-the-number-of-files-in-a-selected-directory-and-its-subdirectories\/#Checking_a_Specific_Website_Directory\" >Checking a Specific Website Directory<\/a><\/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\/how-to-check-the-number-of-files-in-a-selected-directory-and-its-subdirectories\/#Why_Check_File_Counts\" >Why Check File Counts?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/mybox.com\/help\/ro\/knowledgebase\/how-to-check-the-number-of-files-in-a-selected-directory-and-its-subdirectories\/#Summary\" >Summary<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Prerequisites\"><\/span>Prerequisites<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<\/div>\n\n<div id=\"mybox-4266468542\" 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\">You must have SSH access enabled for your hosting account before running the command.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Once connected via SSH, navigate to the directory you want to analyze.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Command\"><\/span>Command<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Run the following command in the SSH terminal:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>echo \"File count for: $(pwd)\" ; for d in `find -maxdepth 1 -type d | cut -d\\\/ -f2 | grep -xv . | sort`; do c=$(find $d | wc -l) ; printf \"$c\\t\\t- $d\\n\" ; done ; printf \"Total: \\t\\t$(find $(pwd) | wc -l)\\n\"\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Example_Output\"><\/span>Example Output<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>File count for: \/home\/user\n\n245         - backups\n1342        - cache\n5876        - logs\n15423       - public_html\n\nTotal:      22886\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Understanding_the_Results\"><\/span>Understanding the Results<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The command displays:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The current directory being analyzed.<\/li>\n\n\n\n<li>The total number of files and subdirectories found within each first-level directory.<\/li>\n\n\n\n<li>The overall total count for the current location.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">For example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>15423       - public_html\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">means that the <code>public_html<\/code> directory contains 15,423 files and subdirectories.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The final line:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Total:      22886\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">shows the total number of files and directories within the analyzed path.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Checking_a_Specific_Website_Directory\"><\/span>Checking a Specific Website Directory<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">To analyze a particular website, first navigate to its directory:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cd ~\/domains\/example.com\/public_html\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Then run the command above.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This can help identify:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Cache directories containing excessive files.<\/li>\n\n\n\n<li>Backup folders consuming inode limits.<\/li>\n\n\n\n<li>Log directories that have grown unexpectedly.<\/li>\n\n\n\n<li>Applications generating large numbers of temporary files.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Why_Check_File_Counts\"><\/span>Why Check File Counts?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Even when disk space usage is low, hosting accounts may be affected by a large number of files.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Monitoring file counts can help:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Improve website performance.<\/li>\n\n\n\n<li>Reduce backup times.<\/li>\n\n\n\n<li>Prevent inode limit issues.<\/li>\n\n\n\n<li>Identify unnecessary files that can be removed.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Summary\"><\/span>Summary<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">To check the number of files and directories within the current location and its subdirectories, connect via SSH and run:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>echo \"File count for: $(pwd)\" ; for d in `find -maxdepth 1 -type d | cut -d\\\/ -f2 | grep -xv . | sort`; do c=$(find $d | wc -l) ; printf \"$c\\t\\t- $d\\n\" ; done ; printf \"Total: \\t\\t$(find $(pwd) | wc -l)\\n\"\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The command provides a quick overview of which directories contain the largest number of files, making it easier to identify potential storage and inode usage issues.<\/p>\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":[584,1326,4880,4881,4882,4883,4884,4885,4886,4887],"class_list":["post-9747","manual_kb","type-manual_kb","status-publish","format-standard","hentry","manualknowledgebasecat-ssh","manual_kb_tag-subdirectories","manual_kb_tag-command-line","manual_kb_tag-file-count","manual_kb_tag-count-files","manual_kb_tag-number-of-files","manual_kb_tag-directory-file-count","manual_kb_tag-directories","manual_kb_tag-first-level-directories","manual_kb_tag-find-command","manual_kb_tag-terminal-command"],"_links":{"self":[{"href":"https:\/\/mybox.com\/help\/ro\/wp-json\/wp\/v2\/manual_kb\/9747","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\/9747\/revisions"}],"predecessor-version":[{"id":9748,"href":"https:\/\/mybox.com\/help\/ro\/wp-json\/wp\/v2\/manual_kb\/9747\/revisions\/9748"}],"wp:attachment":[{"href":"https:\/\/mybox.com\/help\/ro\/wp-json\/wp\/v2\/media?parent=9747"}],"wp:term":[{"taxonomy":"manualknowledgebasecat","embeddable":true,"href":"https:\/\/mybox.com\/help\/ro\/wp-json\/wp\/v2\/manualknowledgebasecat?post=9747"},{"taxonomy":"manual_kb_tag","embeddable":true,"href":"https:\/\/mybox.com\/help\/ro\/wp-json\/wp\/v2\/manual_kb_tag?post=9747"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}