Linux – is there a quick way to change part of a file name in every file and folder in a collection of nested folders a few layers deep

command linefilenameslinuxlinux terminalwindows

windows or linux, either works, it's on an external drive either can read

e.g. change "version2" to "version3" in every file and folder of a project?

Though in this case i want to change patient initials to "patient-1" in every file name and folder name, it's dozens to hundreds of files, tens of gigabytes, and about 10 patients (ten different things to change).

Best Answer

In Linux I'd use find to locate all the relevant files, and then rename:

$ find . -name "*version2*" -exec rename version2 version3  {} \;

EDIT:
To clarify, as per @choroba's comment below, this solution relates to rename (1) distributed as part of the util-linux package.