{"id":276,"date":"2020-08-14T01:06:24","date_gmt":"2020-08-14T01:06:24","guid":{"rendered":"https:\/\/molecularsciences.org\/content\/?p=276"},"modified":"2024-02-02T17:37:00","modified_gmt":"2024-02-02T22:37:00","slug":"bin-rm-cannot-execute-argument-list-too-long","status":"publish","type":"post","link":"https:\/\/molecularsciences.org\/content\/bin-rm-cannot-execute-argument-list-too-long\/","title":{"rendered":"\/bin\/rm: cannot execute [Argument list too long]"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\">Error<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>\/bin\/rm: cannot execute &#91;Argument list too long]<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Cause<\/h3>\n\n\n\n<p>rm can only handle a certain number of arguments. If you run following command in a directory of 500 json files, the argument list is 500<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ rm -f *.json<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Solution<\/h3>\n\n\n\n<p>Use find or find coupled with xargs as follows:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ find . -name \"*.json\" -print0 | xargs -0 rm<\/code><\/pre>\n\n\n\n<p>or<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ find . -name \"*.json\" -delete<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Error Cause rm can only handle a certain number of arguments. If you run following command in a directory of 500 json files, the argument list is 500 Solution Use find or find coupled with xargs as follows: or<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101,34],"tags":[94,102,77,35],"class_list":["post-276","post","type-post","status-publish","format-standard","hentry","category-bash","category-linux","tag-bash","tag-find","tag-json","tag-linux"],"_links":{"self":[{"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/posts\/276","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/comments?post=276"}],"version-history":[{"count":1,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/posts\/276\/revisions"}],"predecessor-version":[{"id":277,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/posts\/276\/revisions\/277"}],"wp:attachment":[{"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/media?parent=276"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/categories?post=276"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/tags?post=276"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}