rename
To rename all files matching *.bak to strip the extension,
rename 's/\e.bak$//' *.bak
To translate uppercase names to lower,
rename 'y/A-Z/a-z/' *
To fix the extension of html files (from .htm to .html)
rename .htm .html *.htm
To check what will be renamed first BEFORE actually renaming
rename -n 's/current_name/new_name/'
More examples:
rename 's/\.flip$/.flop/' # rename *.flip to *.flop rename s/flip/flop/ # rename *flip* to *flop* rename 's/^s\.(.*)/$1.X/' # switch sccs filenames around rename 's/$/.orig/ */*.[ch]' # add .orig to source files in */ rename 'y/A-Z/a-z/' # lowercase all filenames in . rename 'y/A-Z/a-z/ if -B' # same, but just binaries! rename chop *~ # restore all ~ backup files
0 Comments:
Post a Comment
<< Home