Rename all Files With Prefix

  1. Knowledge Base
  2. Data Management
  3. Rename all Files With Prefix

For example, rename all PDF files with NewPrefix:

for selection in *.pdf; do mv -- "$selection" "Prefix$selection"; done

note: the — dashes allow the command to work even if the files start with dashes, otherwise they would be interpreted as command switches

Modified from StackOverflow.

Leave a Reply

Your email address will not be published. Required fields are marked *