Forrest logo
back to the zmv tool

zmv:tldr:3985a

zmv: Interactively move files, with a prompt before every change.
$ zmv -i '${(*)-log}' '${$1-txt}'
try on your machine

The zmv -i '${(*)-log}' '${$1-txt}' command is used in the Zsh shell to rename multiple files.

Here's the breakdown of the command:

  • zmv: This is the command itself. It is specific to the Zsh shell and is used for file renaming.
  • -i: This option stands for "interactive" and prompts for confirmation before renaming each file.
  • '${(*)-log}': This is the pattern to match the files to be renamed. The (*) part captures any part of the filename, and the log is the default value if no match is found.
  • '${$1-txt}': This is the replacement pattern. The $1 refers to the captured part of the filename from the matching pattern, and txt is the replacement value.

In simple terms, this command renames all files by replacing the ending "log" with "txt". For example, a file named "file1.log" would be renamed to "file1.txt".

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the zmv tool