---
title: "Bash vs Python"
description: "A simple case study: It’s not about one programming language killing and replacing the other, its all about the purpose!."
url: "https://h3manth.com/scribe/bash-vs-python/"
canonical_url: "https://h3manth.com/scribe/bash-vs-python/"
markdown_url: "https://h3manth.com/scribe/blog/bash-vs-python.md"
publishDate: "2010-06-30T00:00:00.000Z"
author: "Hemanth HM"
category: "python"
tags: ["python","bash"]
word_count: 98
reading_time_minutes: 1
x_markdown_tokens: 283
content_signal: "ai-train=yes, search=yes, ai-input=yes"
---

# Bash vs Python

> A simple case study: It’s not about one programming language killing and replacing the other, its all about the purpose!.

**A simple case study:** It's not about one programming language killing and replacing the other, its all about the purpose!

_The scenario:_ Using _convert_ to resize images, both in bash and python just for the fun of it.

**First up is BASH:** `**
    
    
    mkdir -p resized
    find. -name '_.jpg'_ -or -name '.png' -or -name '*.gif'</span>
    -exec  convert -resize 648x480 '{}'</span>
    "resized/$(basename '{}')" ';'
    

**`

**Its Pythons turn:**
    
    
    from glob import glob
    from os.path import splitext
    from os import system
    if not path.exists('resized'):
    mkdir('resized')
    for pic in glob.glob('*'):
    if os.path.splitext(pic)[1] in ext:
    system('convert -resize 640x480 "%s" "resized/%s"'
    % (pic,os.path.splitext(pic)[0]))
