Return to Snippet

Revision: 68891
at March 11, 2015 17:24 by jlmarks


Initial Code
#!/usr/bin/env bash


for file in .* *; do
# skip current/previous dirs and unresolved wildcards
if [[ "$file"=="grimm*" ]]
  then
    old="grimm.3"
    new="Grimm.S03E"
    newname=${file/grimm.3/Grimm.S03E}
    mv "$file" ./$newname
    # ${string/substring/replacement}
fi
done

Initial URL

                                

Initial Description
Just a basic bash snippet, of interest is the substring replacement, imo.

Initial Title
bash rename all files which meet pattern

Initial Tags
Bash

Initial Language
Bash