{"id":1071,"date":"2020-09-19T16:10:50","date_gmt":"2020-09-19T21:10:50","guid":{"rendered":"http:\/\/dragonlordwarlock.com\/blog\/?p=1071"},"modified":"2020-09-19T19:59:45","modified_gmt":"2020-09-20T00:59:45","slug":"sharen","status":"publish","type":"post","link":"https:\/\/dragonlordwarlock.com\/blog\/?p=1071","title":{"rendered":"sharen"},"content":{"rendered":"\n<p>A bash script to rename files using its sha256 hash number, no error trapping or anything yet.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"enlighter\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">#!\/usr\/bin\/bash\n\nfunction procfile {\n\tfilename=$1\n\tfilesum=$(sha256sum -b $filename)\n\tfilesha=$(echo $filesum | cut -d \" \" -f1)\n\t# filesha=${filesum%-*}\n\textension=\"${filename##*.}\"\n\tnewfilename=$filesha\".\"$extension\n\tmv $filename $newfilename\n}\n\nfunction showhelp {\n\techo \"sharen or $1, is a program designed to rename a specified file\"\n\techo \"to its sha256 hash as its filename, preserving the file exitension\"\n\techo\n\techo \"The syntax\"\n\techo\n\techo \"\tsharen filename\"\n\techo \"\t\tfilename being the name of the file to process.\"\n\techo\n}\n\nif [ -f \"$1\" ]; then\n\tprocfile $1\nelse\n\tshowhelp $0\nfi\n\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>A bash script to rename files using its sha256 hash number, no error trapping or anything yet.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[32,62],"tags":[121,120,122],"class_list":["post-1071","post","type-post","status-publish","format-standard","hentry","category-programming","category-scripting","tag-bash","tag-programming","tag-sha256"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/dragonlordwarlock.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1071","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dragonlordwarlock.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dragonlordwarlock.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dragonlordwarlock.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dragonlordwarlock.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1071"}],"version-history":[{"count":2,"href":"https:\/\/dragonlordwarlock.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1071\/revisions"}],"predecessor-version":[{"id":1073,"href":"https:\/\/dragonlordwarlock.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1071\/revisions\/1073"}],"wp:attachment":[{"href":"https:\/\/dragonlordwarlock.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1071"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dragonlordwarlock.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1071"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dragonlordwarlock.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1071"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}