Link to home
Start Free TrialLog in
Avatar of tonydba
tonydba

asked on

changefilename

in unix how can you rename  usedindex to usedindex.sql
ASKER CERTIFIED SOLUTION
Avatar of Dan Craciun
Dan Craciun
Flag of Romania 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
#mv usedindex usedindex.sql
#rename usedindex usedindex.sql usedindex

TY/SA
If you're just renaming one at a time use mv file file.sql as Dan Cracium as pointed out.  This command will work on all POSIX compliant systems.

The rename script is a relatively "modern" perl script for renaming multiple files and may or may not exist on your system depending on the gnu packages you have installed.  It's certainly not default on Solaris.  It's probably on most of the  popular distros of linux, but likely not on DSL or any of the distros designed for a tiny footprint.  Depending on your environment, you may not want to use or rely on rename.

You would use perl regular expressions for remane:
rename * *.sql
rename 's/\.bak$//' *.sql
Avatar of tonydba
tonydba

ASKER

Thank you.