Archive for January 19, 2011

Really simple batch renaming in Linux

While working on the photos section of trigonakis.com, I wanted to batch rename some photos, so after the renaming their new name would be prefix_i, where i is a incremental value. The following (stupidly) simple bash script provides the desired functionality:

#!/bin/bash
 
INDEX=1
 
for i in *.$1; do
  echo item $INDEX: "$i" renamed to $2_$INDEX.$1
  mv "$i" $2_$INDEX.$1
  let INDEX=INDEX+1
done

Usage:

#make the script executable
chmod +x scriptname.sh
#move the folder containing the files to be renamed
mv from_path/scriptname.sh to_path/
#run the script
./scriptname.sh FILE_EXTENSION NAME_PREFIX
#example:
./rnm.sh JPG photo

New Weblog, First Post

Distributed Life

Distributed Life

Welcome to Distributed Life blog. As the title suggests, this will be a technology (computer science mostly) related blog. My focus will be on Distributed Systems, since it is my area of interest, but I will also write some posts about Opera browser and generic technology/Internet topics that I find (extremely) interesting.

Topics’ Sources

The topics you will find here will be mostly drawn from my everyday (academic and not) experiences and from other interesting posts or sites that I meet. The Opera related topics will be focused so that they will explain to you why Opera browser is unique (don’t worry I won’t be biased towards Opera. I am the first to say that Opera still has some major problems..)

Posting Frequency

As I said, the posts will be drawn from interesting (or to be precise, from what I consider interesting :-P) topics, so the frequency that I will write new posts will vary from daily to weekly+. Anyaway, this weblog is not meant to be a generic tech one.. who needs one more of these!

Hope you will enjoy! Thank you for reading..