Link to home
Start Free TrialLog in
Avatar of desk
desk

asked on

file rename using bash shell

I'm in need of a bash shell script to
remove the extension *.bak from all files that contain the extension *.bak.
the file names are unknown.
the following commands strip the extension from the filename:
 filename=/test/file.bak
 outfile=${filename%.bak}
 cp filename outfile
will change one file, I need a way of changing multiple files that have unknow filenames. Probably need to use ls somehow.  does anyone know the shell commands to do this?
ASKER CERTIFIED SOLUTION
Avatar of ozo
ozo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of desk
desk

ASKER

Thank You