Organize Images

Here is a super simple Python script to organize images into the following folder structure
Source Structure

Target Structure


# move files module
import os, os.path, time, shutil

def move(path, out):    # take a directory
    fileList = []
    fileCount = 0
    for (path, dirs, files) in os.walk(path,  onerror=oswalkerr):
        for file in files:
            fileList.append(os.path.join(path, file))
        fileCount = fileCount + len(files)
    print('source directory ' + str(fileCount))  
    index = 0;
    for file in fileList:
       var = time.ctime(os.path.getmtime(file))
       year = var[-4:]
       month = var[4:8]
       yearPath = os.path.join(out, year)
       if os.path.exists(yearPath) == False:
       yearMonthPath = os.path.join(yearPath, month.strip())
       if os.path.exists(yearMonthPath) == False:
       newFile = os.path.join(yearMonthPath, os.path.basename(file))
       if os.path.exists(newFile) == True:
           newFileMod = os.path.join(yearMonthPath, 'conflict_' + str(index) + '_' + os.path.basename(file))
           os.rename(newFile, newFileMod)
           index = index + 1
       shutil.move(file, newFile)

    fileCount = 0    
    for (out, dirs, files) in os.walk(out,  onerror=oswalkerr):
        fileCount = fileCount + len(files)
    print('target directory ' + str(fileCount))  
def oswalkerr(err):

if __name__ == "__main__":
    import sys
    move(sys.argv[1], sys.argv[2])

Business Technology Engagement

In the digital age, for business to achieve competitive advantage, time to market, strategic advantage means business partnering with technologists to develop software solutions that provide the differentiation advantage. Typically this boils down to – either we go find a custom off the shelf solution or build technology solution ground up or enhance existing solution, that fits within the existing architecture, to move bits and bytes around. We do this to create or enhance the business processes to deliver on the differentiation advantage. Putting on a simplistic lens, there are two ways the technology and business team work together to determine the solution – one is what I call (1) transactional engagement and other is (2) involved engagement. Without driving into the details, common sense, suggests that involved engagement is better than the transactional engagement. But often times we find the modus operandi is transactional in nature resulting in sub par outcome with lot of non productive “us/them” discussions.

To draw a parallel, a transactional engagement is similar to a car servicing experience. In general, most of us, average car users, we take our car into the dealership because of a problem. We experience the problem (like not getting enough mileage or not having enough power etc) but we have little idea what is under the hood and what has to happen to address the problem. We trust the service technician whom we regard as an expert. So the expert looks under the hood and come back with a list, this is good, that is bad and total cost of $x. While most of us are not very happy with the $x but then we take it as cost of everyday life. A very similar set of interaction occurs between technology and business. The business, like a car user, defines a problem statement which is loaded with assumptions and misunderstanding because they don’t know what is under the hood. The tech guy, like a mechanic, pops up the hood figures out what needs to be done and then rings up number sometimes running into million $. The business with limited alternatives agrees and embark through the work. The tech guy goes to work, and unlike typical car service transaction, the half-baked understanding and assumptions starts falling apart here and once the work is done, there is an even bigger bill for the business to foot. Often times, the finished solution is not exactly the business had in their mind in the first place. Us, seasoned technology folks, all have seen this play out. This is the classic transactional case, where the engagement is transactional. I have a problem, you have a solution, it cost certain money, i pay and i get the solution. Most of the time the solution is not what the business wanted.

On the other hand, the business and tech can try alternate approach to engagement. To draw a parallel, this approach would be akin to adding a new media room in the house. In the case the person who is looking to put in a new media room takes on a very active interest to make sure everything is built as per desired specs and ends up achieving the desired outcome. This, as it turns out, is a very collaborative process where in the builder/architect is intimately involved with end user often time adapting where it is possible. As the product is shaping up the user can walk around and get an intimate preview of how things will finally shape up. Here the constant engagement and ongoing fine tuning is the key. So any structural mods that needs to be done gets identified and done early in the game to keep the cost under control. The end is practically left for cosmetic changes. The same idea holds true for software development as well. The business needs to closely work with technology, get behind the scenes and help identify changes, especially the fundamental ones, early on in the process. This will involve the business and tech to walk around the system and make sense as to how things are coming together and work together to piece it together. The Agile SCRUM process which is replacing the traditional waterfall in a rapid manner provides opportunity for the business to be closely engaged but then this engagement needs to go even further. Agile SCRUM addresses the feedback aspect with the process. What needs to happen more than Agile is the learning. The business need to get more in depth understanding of technology and process, and technology teams need to get much more comfortable with the business. With learning and process, marked by tight collaboration and frequent feedback, the probability of achieving the desired outcome is for certain high.

To be truly successful in any sort of software implementation and software related change, it is important for both the business and technology to work together in close partnership. The technology team need to speak the language of the business and business need to develop courage to look under the hood. This is what will ultimately ensure that multi million dollar investment bears dividends. Without such active engagement… it will be one troubled deployment after another…

Battle of Trafalgar & Corporate Strategy

On 21st October, 1805, off the coast of Cape Trafalgar, Spain; the Royal Navy commanded by Admiral Horatio Nelson was facing off the combined fleet of French and Spanish navies. Commanding a fleet of 27 ships, Lord Nelson was up against 33 Spanish-French fleet commanded by the French Admiral Pierre-Charles Villeneuve. The French Admiral had a 6 ship advantage which, in those days, practically determined the outcome of naval engagement.

The naval battle formation of that time involved the opposing fleets lining up against each other in a close parallel formation and then striking each other with cannon fire followed by hand to hand combat until one side was clearly defeated. Admiral Villeneuve, following the established norm, organized the Spanish-French fleet into a ragged line formation. However, Lord Nelson deviated from the conventional naval orthodoxy and attacked the combined French-Spanish fleets orthogonally instead of lining up along side. Lord Nelson easily breached through the French defenses and inflicted a devastating defeat to the combined fleet.

The battle of Trafalgar was one of the most decisive battles in the history of Naval warfare. England’s victory in this battle established it as unfettered sea power for the next 100 years. While the strategy and technique used in this battle has been studied by military strategists, the learning from this decisive battle can be equally applied to the corporate strategy as well.

In today’s business environment, the advantages of the well managed firms that have been around for many years can be compared to that of the Franch-Spanish fleets. However, the established giant’s might and dominance are being threatened by newly minted upstarts. These new generation of companies fueled by easy capital, global talent and access to sophisticated and unlimited computing power are going against the traditional orthodoxy that defined the success of the entrenched firms. These companies are introducing innovative new products and services faster, better and sometimes cheaper than the incumbents. Take for example, Uber, a firm that was established only in 2009 and went operational in 2011. It is threatening the traditional taxi service industry which has been operating ever since the first model-T rolled out of production lines over a 100 years ago.

Taxi operations is one service industry where status quo reigns supreme. Investments in technology made by established taxi services have been marginal resulting only in incremental changes. Rigid pricing structure and poor customer experience and satisfaction has become the norm. The competitiveness was limited to non customer value creating aspects like who gets to drive a cab etc. In NYC, for example,medallions that gave the driving rights wereauctioned for millions. The inward looking industry did not focus on things that mattered like better customer service, better use of technology or adopting flexible pricing strategies. Uber changed all that! Founded with a vision of providing great customer experience, the company leveraged mobile technology to deliver exceptional service, convenience and information. Uber also innovated by adopting a market driven pricing strategy based on demand and supply. The entrenched taxi service companies while having resources were stifled by conventional orthodoxy in spite of being aware of technological changes happening all around them. They were unwilling to make the change or move fast enough to adapt to the new reality.

In conclusion it is very important for business leaders not to get caught up in the web of conventional orthodoxy because the Lord Nelsons of today are far more ruthless, fast and agile. These nimble competitors not bound by the traditional rules and are bringing newer ideas to the market faster, better and cheaper. The leaders of the established firms must not be afraid to pull a “nelson” on their own business or product lines in order to survive and thrive. They need to embracethe idea of cannibalizing their product lines or to turn the existing business model upside down if necessary. If they are unwilling or unable to do it, the nimbler competitors unconstrained by conventions will come along and destroy the firm transforming the business model inside out. While the real battle of Trafalgar ended with emphatic victory for England, in this new flattened global stage the battles continues ….




These days, hardly a day goes by without hearing the word innovation. We hear how innovative companies disrupts well-heeled incumbents and how some well established, large companies have transformed to develop an innovative edge in the hyper-competitive market. The innovation reality, however, is limited to startups and select few larger companies. For the majority of larger and older companies, the ground realities is actually “business as usual”. Some of them tend to innovate by acquiring others who have innovative edge rather than transforming their own core operations. The employees, in these companies, come in to work, stick to what is expected of them while aligning themselves as much as possible to company’s vision, mission and goals. These employees tend to operate in a centralized hierarchies with command and control structures. Many of these employees still endure the oppressing bell curve rating during the year end that determines their compensation and year end bonuses. In other words these employees are stuck in the box, constrained, unable to contribute to the innovation frontier.

However, there is an ever increasing desire among corporate leaders and organizational psychologist to figure out theory & practices to get the people off the “business as usual” trance and enable the ordinary to do extraordinary work. Various academic studies has firmly established the correlation between employee engagement and motivation to producing creative output. As a mean to further the innovation agenda, companies look to hire intrinsically motivated, engaged and talented individuals to help transform the organization. They do this, because it is clearly established that intrinsically motivated employees are driven and are more conducive to creativity.

Intrinsically motivated employees are highly engaged and produce creative output only when they operate in an environment that involves task variety, decision rights, and intellectual freedom. But in reality, companies that hires these intrinsically motivated top talent, end up making them work in an environment that has remained the same for many years. In the environment process & procedures reigns supreme, decision rights are restricted or at the best limited and organizational red tapes are a norm that constantly reminds what should not be done. In this environment, the employees finds the work banal, constrained and unimaginative. In such a settings the intrinsically motivated employees have two choices (1) Confirm to become a “clocker” or (2) leave to another company where s/he can thrive. These companies, that is seeking the best from the employees, tends to motivate them through extrinsic means which involves year end appraisals and a bell-curve rating which provides support for annual “rank and yank” round-tables. While from a company standpoint the “reward system” seems fair and logical it, this form of motivation leads up to detachment and overall reduction in creativity.

So the natural question is how entrepreneurial companies are able to leverage the same pool of talent available to larger ones but still execute on transformational idea better than larger ones? The answer is the environment in which people operate. In an entrepreneurial company, the leaders are not risk averse. They encourage risk with fail-fast, fail-often and learn fast approach. This type of environment is unthinkable in a command & control hierarchy where employees responsible for any failure are often viewed unfavorably relative to others who are risk averse. The year end rank and yank process ensures these “bad apples” are yanked out. The second attribute of an entrepreneurial firm is low barrier to communication/collaboration. Collaboration happens in a highly networked context where information and ideas flows freely and are fully vetted out. In case of larger firms, collaboration is replaced by meetings where the problem shifts from solving problem at hand to finding time that works for all the participants to meet. The third attribute that makes small entrepreneurial firm effective is speed of decision making. In a small flat hierarchy it is easy to talk to the decision makers and get to decision faster. Speedy decision enables speedy execution. In large organizations, however, decision making takes months and sometimes years because it needs to be vetted out every manager in the hierarchy effectively creating bottleneck as decisioning process moves up and down the chain. Employees also spend inordinate number of hours preparing justification powerpoints that are tailored to whims, fancies and format preference of executives. The fourth attribute is task variety. In smaller firm, an employee perform multiple roles and has the freedom to try out new things without fear. He/she has unconstrained, multi-dimensional learning opportunities. In larger firms, however, employees are generally stuck in a straight-jacket with very little elbow room to try anything new. Big firm risk aversion culture means, the firm would rather hire a new employee from the street rather than empower an internal employee with desire, ambition and ability. The fifth attribute is nimbleness. The small firm is able to react fast to the market condition and incorporate market feedback rapidly. The distance between market feedback provider and the person who is able to incorporate the feedback is small, and hence the probability of information dissipation due to “chinese whisper” is low. In case of large firm, market feedback flows through large hierarchy chain and takes many days or even months before it gets to the person in charge of implementing the change. In addition, there is high probability of feedback gets mutated along the way.

Even in the case nimble entrepreneurial firm, as the innovative product takes a foothold in the market, the firms starts focusing on scale economies. With scale the firm gets larger, the founders start to lose “control” and the work environment mutates. The environment or culture that reflected the founder entrepreneurial spirit now starts to become more “organized” and banal. The differences in resources, collaboration and coordination costs slowly increases. Leaders, to achieve better control, tend to put in place process & procedures which results in increased bureaucracy and routinization of work. This standardization produces a degree of “command & control” generally results in diluting individuals’ sense of ownership and responsibility for their work. The routinization, however, enables firm to transfer work to cheaper location further diluting individuals sense of ownership. In such set up, the company starts to loses the innovation advantages that was primarily because of the intrinsically motivated and highly engaged employee. With employees now operating in a production line mode, innovation becomes a jargon and a lofty goal.

In the age where innovation edge dictates if the firms will survive the next decade, larger companies need to start doing things differently. These companies need to make best use of their assets which are not buildings, not products, not equipments but their people. To control cost and to be fundamentally be innovative, companies need to fundamentally rethink how the organization is designed, how work is conducted, how engaged are employees, and how people are rewarded. Without such inside-out people transformation, the only other way to innovate is by acquiring small innovative trendsetter. But the best long term strategy would be a inside out metamorphosis rather than externally induced transformation. In my next article I will provides some of my ideas on how big firms could re-do their organizational architecture to better compete.