Tag: one-liners

  • Rename all files in directory from $file to $newfile

    The what?

    Dead simple.
    How do I rename

    hello_kitty2.png
    hello_kitty3.png

    to

    byebye_kitty2.png
    byebye_kitty3.png

    I think it’s simple, but it’s hard to Google for this kind of thing unless you already know.

    The how…..!

    You can do this with a simple one-liner with bash

    for file in $(ls hello_ki*); do mv "$file" "${file/hello/byebye}"; done