Rackspace Cloud FIles Bulk Delete objects prefixed/* wildcard php sdk

Hi Guys

 

Rackspace cloud files is an awesome file storage system, We upload a file and can make it publicly available through their CDN.

While I use Cloud files in pretty much all my projects at work or personal stuff, one thing that I did today was to delete objects with specific prefix

e.g.

Lets say I have these objects under container “jcorg”

  • hello
  • hello1
  • hello2
  • anothervaluableobject

and I want to delete all objects whose name starts with hello

Here is a code snippet that will be handy for you

Language: PHP
API link: https://github.com/rackspace/php-opencloud

and of course you can use equivalent code in other language SDKs too

 

 

Code Snippet

Let me give you a brief overview to you

  1. First we are creating a connection to Rackspace server, depending on which region you are in you will use either RACKSPACE_US or RACKSPACE_UK to authenticate your request.
  2. Then we are connection to our object store
  3. Then we are getting hold of object list where name or an object starts with “hello
  4. Finally we are iterating on objects found and deleting them. You can check object name here to just to filter them out before you process them for deletion

I hope this makes sense, but just in case if you have a question, do leave your comment.

 

 

Australian suburb boundaries database released

Hello Its been a great pleasure for me to release Australian suburb boundaries database, A suburb boundary is represented in a polygon of longitude and latitude points. More details can he found on product page which is located here Product … [Continue reading]

How to make xml_split, xml_merge, xml_pp, xml_grep, xml_spellcheck under XML-Twig tools work on Windows

XML twig

Large XML files could sometimes lead to overall slowness of your program. Thus it makes sense to sometimes split them to rearrange contents within to optimize querying your XML files. This post will touch base on how to split a large XML file on … [Continue reading]

Yii Framework Apply Custom layout to a controller or action

If you are using Yii PHP framework you are using one of the fastest PHP frameworks around. Sometimes there are minor things that we want to do and couldn't find a document that is to the point and precise in what you are looking after. This Quick … [Continue reading]

Installing Apache thrift, Cassandra 2.x and YACassandra-PDO on CentOS 6.5+

Hello, Well after a long time this is my in length article, the reason I am writing is because of all the stuff I have been gone through building thrift and cassandra-pdo on centOS 6.5 Versions I will be writing about installing latest version … [Continue reading]

Installing YAF php framework and getting /usr/include/php/ext/pcre/php_pcre.h:29:18: error: pcre.h: No such file or directory on Centos 6+

Hi Guys, Yaf framework appears to be the fastest framework around, logically so because its built with C and compiled in a PHP extension. While installing Yaf, I ran into a problem where it seems like make was complaining about pcre.h missing … [Continue reading]

Config file “/etc/amavisd.conf” does not exist

Hi guys, A quick tip If you get this error either trying to showkeys  or any other action using amavisd You can quickly fix that Generally amavisd.conf file reside under /etc/ but on many distros it can be found … [Continue reading]

Linux Find files newer than certain date and time

Yeah I know generally we pretty much always want to find older files but there are some use cases where finding newer files than a certain date time is a requirement. Ok being no where near to your Linux expertise, I will show you how I do it, you … [Continue reading]

Google MarkerClusterer Handling Multiple Markers On Same Geo Location

When you are dealing with addresses on Google Maps there are times when you have multiple addresses for a same location. For example if you live in a building with 200+ apartments, building address remains the same but you also add apartment number … [Continue reading]

How to clear DNS Cache in Windows small business server 2011 or windows 2008 r2

Clear DNS cache

G'day While I do not write on Windows server too often but here is that once in a blue moon article or you can assume a quick tip on how to clear DNS cache, Reason can be any but sometimes we have to do it. Locally we will just … [Continue reading]