<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: rename code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Thu, 24 Jul 2008 02:54:17 GMT</pubDate>
    <description>DZone Snippets: rename code</description>
    <item>
      <title>Linux Shell script to rename files</title>
      <link>http://snippets.dzone.com/posts/show/5192</link>
      <description>Before rename command I was using following shell script to rename my mp3s&lt;br /&gt;&lt;code&gt;&lt;br /&gt;#!/bin/bash&lt;br /&gt;# To remove blank space&lt;br /&gt;if [ $# -eq 0 ];&lt;br /&gt;then&lt;br /&gt; echo "Syntax: $(basename $0) file-name [command]"&lt;br /&gt; exit 1&lt;br /&gt;fi&lt;br /&gt;FILES=$1&lt;br /&gt;CMD=$2&lt;br /&gt;for i in $FILES&lt;br /&gt;do&lt;br /&gt;# remove all blanks and store them OUT&lt;br /&gt;OUT=$(echo $i | sed 's/  *//g')&lt;br /&gt;if [ "$CMD" == "" ];&lt;br /&gt;then&lt;br /&gt;#just show file&lt;br /&gt;echo $OUT&lt;br /&gt;else&lt;br /&gt;#else execute command such as mv or cp or rm&lt;br /&gt;[ "$i" != "$OUT" ] &amp;&amp; $($CMD  "$i"  "$OUT")&lt;br /&gt;fi&lt;br /&gt;done&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Sun, 02 Mar 2008 16:13:16 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5192</guid>
      <author>flynets (Flynets is an italian student of computer science with passion for GNU/Linux and hacktivism.)</author>
    </item>
  </channel>
</rss>
