[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [spam] Renaming multiple extensions-file on unix..



On Tue, 2003-05-27 at 02:54, Miranda, Joel Louie M wrote:
> Hello,
> 
> I have this html pages and I just want to rename them all into *.php
> Anyone have any ideas? Doing this in just one command? Or Just a script?
> 
> 
> Thanks,
> Louie

(in bash)
-----------------
#!/bin/bash
FROM=$1
TO=$2
ls *.$FROM | while read FILEWITHEXT; do
        FILE=$(basename $FILEWITHEXT $FROM);
        mv $FILE$FROM $FILE$TO;
done
---------------
save in rename.sh
% chmod +x rename.sh

% rename.sh html php

-- 
Kevin Mark <kmark@pipeline.com>

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: