Need a file renaming facility

William E. Davidsen Jr davidsen at steinmetz.ge.com
Thu Apr 28 04:03:10 AEST 1988


  As long as the rename is the way you describe, "rename a file with a
suffix to be the same name without the siffix" the solution is easy. It
used sh (or ksh) as written:
	for src in *.suffix		# all names of this type
	do
	 dest=`basename $src .suffix`	# strip the suffix
	 mv $src $dest			# and move the file
	done

  I don't have access to a pure BSD system to see if basename is there;
it's in Ultrix and SunOS which are as close as I come.
-- 
	bill davidsen		(wedu at ge-crd.arpa)
  {uunet | philabs | seismo}!steinmetz!crdos1!davidsen
"Stupidity, like virtue, is its own reward" -me



More information about the Comp.unix.questions mailing list