how to rename a number of files

Hi
I need to rename about hundred of files which contain ".R " and the end, for example:
/t1/data/f2993trn.ix7.R
The new file should not have ".R" extension, ex:
/t1/data/f2993trn.ix7.R

Is there a command which I can put in the loop to do this? Thansk for any advice -A

cat your_list_of_files |
while read file_nm ; do

  echo /bin/mv $file_nm ${$file_nm%.*}

done

save that in a script.
run it.
if it looks good, pipe it to /bin/ksh:

quirks_script | /bin/ksh

and voila.

Not sure if ${$file_nm%.*} will give you grief but you can do this:

ls *.R 2>/dev/null|while read file_nm ; do
 echo mv $file_nm ${file_nm%.*}
done

Then do what quirkasaurus said to check and then run.

no need ls in fact

for file in *.R
do
....
done

Not only is ls unnecessary, but it will break the script if any filenames contain spaces.

The filenames should be quoted:

for file in *.R ; do
 echo mv "$file" "${file%.R}"
done

Not sure about Unix flavors, but if you have Linux, then you don't even need a loop. The rename command can fix the file names.

$
$ uname -o
GNU/Linux
$
$ ls -1
file1.R
file2.R
file3.R
file4.R
file5.R
file 6.R
$
$ rename .R '' *.R
$
$ ls -1
file1
file2
file3
file4
file5
file 6
$
$

HTH,
tyler_durden

There are two different versions of rename in Linux distributions, and the syntax is not the same for both. If you have a rename command, check the man page for the correct syntax.