{"id":949,"date":"2013-04-24T01:34:01","date_gmt":"2013-04-24T01:34:01","guid":{"rendered":"http:\/\/garysieling.com\/blog\/?p=949"},"modified":"2013-04-24T01:34:01","modified_gmt":"2013-04-24T01:34:01","slug":"moving-files-and-folders-into-hashed-subfolders","status":"publish","type":"post","link":"https:\/\/www.garysieling.com\/blog\/moving-files-and-folders-into-hashed-subfolders\/","title":{"rendered":"Moving files and folders into hashed subfolders"},"content":{"rendered":"<p>The following will move a series of files into subfolders. It hashes the file names, building a two character, two folder deep hierarchy to split the files, e.g. a1\/b2. The motivation for this is to split 500,000 folders into a manageable hierarchy, to avoid file system limits &#8211; in NTFS this is quite slow, and well over the 64,000 limit in ext4.<\/p>\n<pre>\nvi f\nfor f in `ls pacer\/`; do echo -n $f | md5sum | sed 's`\\(..\\)\\(..\\).*`\\1\/\\2\/`' | tr -d '\\n'; echo $f; done;\n.\/f > t\nmkdir ..\/pacer2\ncat .\/t | sed 's`\\(..\\)\/\\(..\\)\/\\(.*\\)`mkdir pacer2\/\\1\\nmkdir pacer2\/\\1\/\\2\\nmv pacer\/\\3 pacer2\/\\1\/\\2\/\\3`' > dirs\n.\/dirs\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>The following will move a series of files into subfolders. It hashes the file names, building a two character, two folder deep hierarchy to split the files, e.g. a1\/b2. The motivation for this is to split 500,000 folders into a manageable hierarchy, to avoid file system limits &#8211; in NTFS this is quite slow, and &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.garysieling.com\/blog\/moving-files-and-folders-into-hashed-subfolders\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Moving files and folders into hashed subfolders&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[4],"tags":[79,385,495],"aioseo_notices":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/949"}],"collection":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/comments?post=949"}],"version-history":[{"count":0,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/949\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/media?parent=949"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/categories?post=949"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/tags?post=949"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}