rename
eharetea

Renaming directories based on the parent directory.

Rename script.

Date Created:Friday December 29th, 2006 03:41 AM
Date Modified:Wednesday July 30th, 2008 05:06 PM

RENAME SCRIPT

#!/bin/bash
for FNAME in `find ./* -type f`
do DIR=`dirname $FNAME`"/subdir_name"
echo "File: $FNAME\n"
echo "mv $FNAME $DIR \n"
done

#!/bin/bash
for x in `find ./ -name "jumpinf*"`
do
replace=`echo $x|sed 's/f//g'`
mv $x $replace
done

USE FOR CONVERTING IMAGES
for x in `find ./ -name "*.pic"`
do replace=`echo $x|sed 's/pic/tga/g'`
icp $x $replace
done


TAKING THE NAME OF THE PARENT FOLDER
for x in `ls`
do echo $PWD|sed 's/\// /g'|awk '{print $NF}'
done

TAKE PARENT FOLDER AND ADD TO NAME
for x in `ls`
do parent=`pwd|sed 's/\// /g'|awk '{print $NF}'`
mv $x ${parent}_$x
done



Downloads:
Download: rename.txt 600 B

Please login or Click Here to register for downloads
Creative Commons License
rename by Dan Lynch
is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License
Based on a work at www.3daet.com
Permissions beyond the scope of this license may be available at http://www.3daet.com