From the course: Learning Zsh

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Renaming files with zmv

Renaming files with zmv - Unix Tutorial

From the course: Learning Zsh

Start my 1-month free trial

Renaming files with zmv

- [Narrator] Copying files and moving and renaming them are common activities for a Command Line user and usually copying and moving files is a pretty basic operation. And while we can copy files with cp and move or rename them with mv, there's a Z shell function called zmv that lets us work with files in a more programmable way. It lets us specify patterns to use when moving files around, which can come in handy for more complex operations, like renaming multiple files at once. Zmv is a function, so we'll need to enable it. To do that, I'll write autoload -U zmv. Now let's create a folder with a bunch of files in it. There we go. Zmv used globbing to work with files and when we're using zmv, we'll use globbing characters to match certain parts of file names and then we'll use variables that represent those globs in the resulting file names. So for example, let's say we wanted to rename all of these files to log_ and…

Contents