On Thu, Jun 27, 2002 at 12:02:46PM -0600, [EMAIL PROTECTED] wrote:
>
> It worked, but changes only ext .abc to .xyz style. Not increamental.
>
> Thanks Bish, but I want incremental extention. Why r u testing my weak
> IQ ? :( Pl help !
>
---end quoted text---
Okay, this script should take any file with a specified extn,
and rename it to any other with an incremental suffix with a
specified character. Run it as: "scriptname extn char"
[e.g. scriptname abc s] where you want extn to be s01, s02 ..
for all files ending with .abc to be changed.
-----------------<snip>-----------------
#!/bin/bash
if [ $# -ne 2 ]; then
echo "Usage: `basename $0` old_suffix new_suffix_char"
exit 1
fi
CNT=0
NEW_SFX_CHAR=$2
OLD_SFX=$1
for FILENAME in *$OLD_SFX; do
CNT=$((CNT+1))
NEW_SFX_2=`printf "%02d" $CNT`
NEW_SFX=$NEW_SFX_CHAR$NEW_SFX_2
echo "moving $FILENAME to ${FILENAME%$1}$NEW_SFX"
mv $FILENAME ${FILENAME%$1}$NEW_SFX"
done
exit 0
----------------</snip>-----------------
--
:
####[ Linux One Stanza Tip (LOST) ]###########################
Sub : defrag under linux LOST #272
Inherently, ext2 file systems limit fragmentation as far as
possible, however, external fragmentation (where a large file
is spread over non-contiguous sectors may occur). For defrag-
mentation of such type ...
http://ibiblio.org/pub/Linux/system/filesystems/defrag-0.70.tar.gz
####<[EMAIL PROTECTED]>########################################
:
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
No, I will not fix your computer.
http://thinkgeek.com/sf
_______________________________________________
linux-india-help mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/linux-india-help