{"id":2286,"date":"2017-12-08T06:27:32","date_gmt":"2017-12-08T06:27:32","guid":{"rendered":"http:\/\/www.scmgalaxy.com\/tutorials\/?p=2286"},"modified":"2020-01-09T09:48:35","modified_gmt":"2020-01-09T09:48:35","slug":"find-a-number-of-file-in-directories-recursively","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/find-a-number-of-file-in-directories-recursively\/","title":{"rendered":"Find a Number of File in Directories Recursively"},"content":{"rendered":"<p><strong>scmuser created the topic: find a number of file in directories recursively<\/strong><br \/>\nI have several directories and files underneath&#8230;how to find only files from all directories&#8230;<\/p>\n<p>any command<\/p>\n<p><strong>rajeshkumar replied the topic: Re: find a number of file in directories recursively<\/strong><br \/>\nTry following command<br \/>\nfind .\/ -type f | wc -l<\/p>\n<p>For finding only files from all directories recursively<br \/>\nfind .\/ &#8211; type d | wc -l<\/p>\n<p>For finding only directory om all directories recursively<br \/>\nRegards,<br \/>\nRajesh Kumar<br \/>\nTwitt me @ <a href=\"http:\/\/twitter.com\/RajeshKumarIn\" target=\"_blank\" rel=\"noopener\">twitter.com\/RajeshKumarIn<\/a><\/p>\n<p><strong>opendesk replied the topic: Re: find a number of file in directories recursively<\/strong><br \/>\nFrom DOS Command prompt, you can do:<\/p>\n<p>dir \/A-d \/b \/s<\/p>\n<p>or in java, you need to do recursion. Here is a java code snippet.<\/p>\n<p>public void visitAllFiles(File dir) {<br \/>\nif (dir.isDirectory()) {<br \/>\nString[] children = dir.list();<\/p>\n<p>for (int i = 0; i < children.length; i++) {\nvisitAllFiles(new File(dir, children));\n}\n} else {\nprocessFiles(dir);\n}\n}\n\nAll the best :)\n\n\n<strong>rajeshkumar replied the topic: Re: find a number of file in directories recursively<\/strong><br \/>\nGood Input.. Thanks a lot.<\/p>\n<p>Regards,<br \/>\nRajesh Kumar<br \/>\nTwitt me @ <a href=\"http:\/\/twitter.com\/RajeshKumarIn\" target=\"_blank\" rel=\"noopener\">twitter.com\/RajeshKumarIn<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>scmuser created the topic: find a number of file in directories recursively I have several directories and files underneath&#8230;how to find only files from all directories&#8230; any command rajeshkumar replied&#8230; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[454],"tags":[474],"class_list":["post-2286","post","type-post","status-publish","format-standard","hentry","category-shell-script","tag-directories"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/2286","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=2286"}],"version-history":[{"count":1,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/2286\/revisions"}],"predecessor-version":[{"id":2287,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/2286\/revisions\/2287"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=2286"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=2286"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=2286"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}