{"id":6607,"date":"2012-08-20T11:24:02","date_gmt":"2012-08-20T15:24:02","guid":{"rendered":"http:\/\/www.ezrasf.com\/wplog\/?p=6607"},"modified":"2012-08-27T11:46:25","modified_gmt":"2012-08-27T15:46:25","slug":"counting","status":"publish","type":"post","link":"https:\/\/www.ezrasf.com\/wplog\/2012\/08\/20\/counting\/","title":{"rendered":"Counting"},"content":{"rendered":"<p>In the beginning I used <strong>TOTAL=`ls <strong>\/d2lmig\/*\/*\/bak\/*\/*\u00c2\u00a0<\/strong>| wc -l`<\/strong> to get a total count. All was good.<\/p>\n<p>Until at around 55,000 files I got:\u00c2\u00a0-bash: \/bin\/ls: Argument list too long.<\/p>\n<p>Then I used <strong>TOTAL=`find \/d2lmig\/*\/*\/bak\/*\/* -name *.bak | wc -l`<\/strong> to get a total count.\u00c2\u00a0All was good.<\/p>\n<p>Until at around 90,000 files I got:\u00c2\u00a0-bash: \/usr\/bin\/find: Argument list too long.<\/p>\n<p>It happened that I was already using a for do done loop and getting a count for each bak directory. So I added within the for loop:<\/p>\n<blockquote><p>TOTAL=`expr $TOTAL + $COUNT`<br \/>\nif [ $RUNTYPE = &#8220;INTERNAL&#8221; ] ; then echo &#8221; Running total = $TOTAL&#8221; ; fi<\/p><\/blockquote>\n<p>(INTERNAL is a value I pass at the command line that controls whether the email is sent to me or other parties.)<\/p>\n<p>Comment out the TOTAL using find. Voila.<\/p>\n<p>I know, I should have done it this way in the beginning. Sloppy code to go back and get the total. Maybe because I have this post here, I reference it and not be so bad in the future.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In the beginning I used TOTAL=`ls \/d2lmig\/*\/*\/bak\/*\/*\u00c2\u00a0| wc -l` to get a total count. All was good. Until at around 55,000 files I got:\u00c2\u00a0-bash: \/bin\/ls: Argument list too long. Then I used TOTAL=`find \/d2lmig\/*\/*\/bak\/*\/* -name *.bak | wc -l` to get a total count.\u00c2\u00a0All was good. Until at around 90,000 files I got:\u00c2\u00a0-bash: \/usr\/bin\/find: Argument [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"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,"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":4,"activitypub_interaction_policy_quote":"anyone","activitypub_status":"","footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[109],"tags":[2544,324,348,2541,2540,2543,2542,2380,2539,2545,2546],"class_list":["post-6607","post","type-post","status-publish","format-standard","hentry","category-unix","tag-arguemt-list","tag-bash","tag-command-line","tag-count","tag-expr","tag-find","tag-loop","tag-posted-2012","tag-sloppy-code","tag-total","tag-wc"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/s1rUBW-counting","jetpack-related-posts":[],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/www.ezrasf.com\/wplog\/wp-json\/wp\/v2\/posts\/6607","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ezrasf.com\/wplog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ezrasf.com\/wplog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ezrasf.com\/wplog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ezrasf.com\/wplog\/wp-json\/wp\/v2\/comments?post=6607"}],"version-history":[{"count":0,"href":"https:\/\/www.ezrasf.com\/wplog\/wp-json\/wp\/v2\/posts\/6607\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.ezrasf.com\/wplog\/wp-json\/wp\/v2\/media?parent=6607"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ezrasf.com\/wplog\/wp-json\/wp\/v2\/categories?post=6607"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ezrasf.com\/wplog\/wp-json\/wp\/v2\/tags?post=6607"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}