{"id":4641,"date":"2023-07-12T06:20:00","date_gmt":"2023-07-12T04:20:00","guid":{"rendered":"https:\/\/expert-only.com\/?p=4641"},"modified":"2023-09-17T13:12:34","modified_gmt":"2023-09-17T11:12:34","slug":"list-files-recursively-with-cmd","status":"publish","type":"post","link":"https:\/\/expert-only.com\/en\/ms-dos\/list-files-recursively-with-cmd\/","title":{"rendered":"How to list Windows files recursively with cmd including subfolders?"},"content":{"rendered":"\n<h4 class=\"wp-block-heading has-text-align-left\"><strong><em>List all the files contained in a folder and its subfolders recursively with a cmd script.<\/em><\/strong><\/h4>\n\n\n\n<p>Per default, use the cmd tool with the dir command allows to list all files and folders within a given folder, but not recursively. To display a complete of files and optionally folders within all the subfolders, use the dir command options as follows. Indeed, in today&#8217;s digital age, managing and navigating through files efficiently is crucial, especially for an IT professional. Whether you are an administrator or a regular user, understanding the intricate workings of the Windows command prompt can simplify complex tasks. This tutorial will guide you through using the dir command in the command prompt to list files contained in a folder and its subfolders recursively.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-introduction-to-the-windows-dir-command\">Introduction to the Windows dir command<\/h2>\n\n\n\n<p>Per default, the dir command in the Windows Command Prompt provides a snapshot of all files and folders in a given directory. However, this doesn&#8217;t go into the subdirectories. To delve deeper, we need to use some specific recursive options. To do so, <strong>type the dir command to list the folder content with the recursive dedicated option<\/strong>. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-listing-all-files-recursively-with-cmd\">Listing All Files Recursively with cmd<\/h2>\n\n\n\n<p>The <a href=\"https:\/\/www.computerhope.com\/jargon\/c\/commandi.htm\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">command<\/a> below displays the files inside a folder and all subfolders, recursively. Indeed every folder has a list of files, with its subtotal of file counts and size. This command provides a <a href=\"https:\/\/dictionary.cambridge.org\/dictionary\/english\/recursive\" target=\"_blank\" rel=\"noreferrer noopener\">recursive<\/a> list, displaying the content of each folder as it moves through the subdirectories.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"bat\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">dir \/s<\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-list-recursively-all-files-without-splitting-by-folders\">List recursively all files without splitting by folders<\/h2>\n\n\n\n<p>To get a list of files recursively in a single list without split between each subfolder, type this cmd command:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"bat\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">dir \/s \/b<\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-list-recursively-all-files-without-the-folders-0\">List recursively all files without the folders<\/h2>\n\n\n\n<p>The command displays all the files and folders in the current folder and all its subfolders. To list only the files and not the folders, use this command. The <strong>\/a<\/strong> option is an attribute filter. Then the <strong>-d<\/strong> option means <strong><em>minus folders<\/em><\/strong>, then the folder are not displayed in the command prompt.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"bat\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">dir \/s \/b \/a-d<\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Conclusion<\/h3>\n\n\n\n<p>Navigating and managing Windows files through the Command Prompt is a vital skill. The dir command, with its variety of options, offers a versatile tool for listing files in a directory and its subdirectories. Once mastered, you can efficiently organize, manage, and access your data. As always, <strong>be careful when modifying or deleting files in batch and remember to back up crucial data regularly<\/strong>.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Tutorials to manage Windows files with cmd and powershell<\/h5>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/expert-only.com\/en\/ms-dos\/list-files-recursively-with-cmd\/\">Copy recursively files and folders in cmd with xcopy.<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/expert-only.com\/en\/powershell\/copy-files-folders-recursively-powershell\/\">Copy files and folders recursively with PowerShell<\/a>.<\/li>\n\n\n\n<li><a href=\"https:\/\/expert-only.com\/en\/ms-dos\/delete-windows-files-recursively-in-cmd\/\">Delete Windows files recursively in cmd<\/a>.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>List all the files contained in a folder and its subfolders recursively with a cmd script. Per default, use the cmd tool with the dir command allows to list all files and folders within a given folder, but not <a class=\"mh-excerpt-more\" href=\"https:\/\/expert-only.com\/en\/ms-dos\/list-files-recursively-with-cmd\/\" title=\"How to list Windows files recursively with cmd including subfolders?\">&#8230;<\/a><\/p>\n<\/div>","protected":false},"author":1,"featured_media":5644,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[410],"tags":[417,418,420,424,414],"class_list":{"0":"post-4641","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-ms-dos","8":"tag-file","9":"tag-folder","10":"tag-list","11":"tag-recursive","12":"tag-script"},"_links":{"self":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/posts\/4641","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/comments?post=4641"}],"version-history":[{"count":3,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/posts\/4641\/revisions"}],"predecessor-version":[{"id":26995,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/posts\/4641\/revisions\/26995"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/media\/5644"}],"wp:attachment":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/media?parent=4641"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/categories?post=4641"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/tags?post=4641"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}