Using Wildcards with 'rename'
rename
does not allow wildcards in the from
and to
strings. When you run rename 2010.306.18.*.*.*.*. "" *
it is actually your shell which first expands the wildcard and then passes the result of the expansion to rename
, hence why it does not work.
Instead of using rename
, use a loop as follows:
for file in *do tmp="${file##2010*TW.}" # remove the file prefix mv "$file" "${tmp/../_}" # replace dots with underscoredone