Skip to Main Content



File Management

Tips for managing digital files by the Iowa State University Library

Tools for batch renaming

Mac

Finder

Use Finder to select multiple files. From the File menu, choose Rename... Then use the pop-up menu to specify whether to replace text in the file names, add text before or after the current name, or format the names with an index, counter, or date.

For detailed instructions, see the macOS User Guide: Rename multiple items.

Windows

PowerRename

Microsoft PowerRename is an open-source bulk renaming tool that can be used with Windows File Explorer. To use PowerRename, install Microsoft PowerToys.

Bulk Rename Utility

Bulk Rename Utility is a Windows-compatible file renaming application. It is free for personal, private use; commercial licenses are available for purchase.

Shell commands

See Documentation: File lists for more information about using shell commands.

Terminal

Use the following command to substitute one string for another in all the file names in a folder.

Note: Before using this command, install Homebrew and then Homebrew's rename script: brew install rename

rename 's/expr1/expr2/' [files]

This command includes these components:

  • s: Substitute
  • expr1: String 1, or what you want to replace
  • expr2: String 2, or what will replace String 1 
  • [files]: Which files to rename
    • You can use * to rename all files.

Example:

rename 's/-draft//' *

Old name New name
file1-draft.docx file1.docx
file2-draft.docx file2.docx

See also Linux rename command.

PowerShell

Use the following command to substitute one string for another in all the file names in a folder.
dir | rename-item -NewName {$_.name -replace "string1","string2"}

  • string1: What you want to replace
  • string2: What will replace string1 
    • Use " " to indicate spaces.
    • Use "" to indicate deletion.

Example:

dir | rename-item -NewName {$_.name -replace "-draft",""}

Old name New name
file1-draft.docx file1.docx
file2-draft.docx file2.docx

For more information, see Microsoft PowerShell Reference: Rename-Item.

Contact information

Questions? Contact us!

Consultations are also available by request.

Megan O'Donnell, Research Data Services Lead

datashare@iastate.edu

Heather Campbell, Head of Metadata Services

metadata@iastate.edu

File Management by Heather Campbell and Megan O'Donnell is licensed under CC BY 4.0 Attribution