O'Reilly logo

Linux Shell Scripting Cookbook by Sarath Lakshman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Renaming and moving files in bulk

Renaming a number of files is one of the tasks we frequently come across. A simple example is, when you download photos from your digital camera to the computer you may delete unnecessary files and it causes discontinuous numbering of image files. Sometimes you many need to rename them with custom prefix and continuous numbering for filenames. We sometimes use third-party tools for performing rename operations. We can use Bash commands to perform a rename operation in a couple of seconds.

Moving all the files having a particular substring in the filename (for example, same prefix for filenames) or with a specific file type to a given directory is another use case we frequently perform. Let's see how to write scripts ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required