{"id":193,"date":"2015-10-15T09:11:58","date_gmt":"2015-10-15T08:11:58","guid":{"rendered":"http:\/\/www.haxed.me.uk\/?p=193"},"modified":"2015-10-16T09:47:38","modified_gmt":"2015-10-16T08:47:38","slug":"bash-script-to-upload-directory-to-a-cloud-files-container-automatically","status":"publish","type":"post","link":"https:\/\/haxed.me.uk\/index.php\/2015\/10\/15\/bash-script-to-upload-directory-to-a-cloud-files-container-automatically\/","title":{"rendered":"BASH Script to Upload Directory to a Cloud Files Container automatically"},"content":{"rendered":"<p>Hi guys. So I was working with cloud files API and I thought I would put together a piece of code that allows uploads of an entire file structure to a cloud files container. It won&#8217;t work with sub directories yet, but it&#8217;s simple enough to give anyone a better understanding of how this works. Please note the token I am using is not a real genuine token.<\/p>\n<pre>\r\n!\/bin\/sh\r\n\r\n# This Scripts Uploads an entire file structure to a cloud files container\r\n\r\n# CLOUD FILES TOKEN\r\nTOKEN='AAAjsa_x-Pe2YuyHVM7kuS-A67LcZNx4-MOCKTOKENjZ1GoLTwVKcQhyE9t-gZIIBMknJBEtD2JbJbWS4W1Pd7wJqXfxgN2ykVSfhcga1ch-vwBFAvlsjMj-ew6eMSG-TyEG7Q_ABC231'\r\n\r\n\r\n\r\n# Folder to Upload FROM\r\nFILES=\/root\/cloud-files\/files\/*\r\n\r\n# Container to Upload to\r\nCONTAINER=meh2\r\n\r\n\r\nfor f in $FILES\r\ndo\r\n\r\necho \"Upload start $f ...\"\r\nFILENAME=`basename $f`\r\n# take action on each file\r\n\r\ncurl -i -X PUT https:\/\/storage101.lon3.clouddrive.com\/v1\/MossoCloudFS_10045567\/meh2\/$FILENAME -T \/root\/cloud-files\/files\/$FILENAME -H \"X-Auth-Token: $TOKEN\"\r\n\r\ndone\r\n\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Hi guys. So I was working with cloud files API and I thought I would put together a piece of code that allows uploads of an entire file structure to a cloud files container. It won&#8217;t work with sub directories &hellip; <a href=\"https:\/\/haxed.me.uk\/index.php\/2015\/10\/15\/bash-script-to-upload-directory-to-a-cloud-files-container-automatically\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-193","post","type-post","status-publish","format-standard","hentry","category-uncategorised"],"_links":{"self":[{"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/posts\/193","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/comments?post=193"}],"version-history":[{"count":4,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/posts\/193\/revisions"}],"predecessor-version":[{"id":201,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/posts\/193\/revisions\/201"}],"wp:attachment":[{"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/media?parent=193"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/categories?post=193"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/tags?post=193"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}