wiki:Documentation/UserGuide/ReName

Version 1 (modified by luyssaert, 9 years ago) (diff)

--

There are several reasons why you suddenly have the need to change the name of tens if not hundreds of files at once. The mv command in unix seems a bit limited in its scope so here are two more options.

RENAME

To rename lists of files use the rename command in unix

rename [string to replace] [string to replace it with] [files for which you want to replace the string]

SHELL SCRIPT

Write a little shell script

#!/bin/bash
echo "rename the files..."
for file in *.nc
do
    echo "Rename $file ."
   # mv -i "${file}" "${file/cru_nicolasgrid_/cmip5_ipsl_rcp4p5_}"
    mv -i "${file}" "${file/cmip5_ipsl_rcp4p5/ipsl_rcp4p5}"
done