bash how to rename directory

Answer

Use the "rename" command. Syntax of rename command:

rename [options] expression replacement file

If we want to rename directory "old-name-dir" to "new-name-dir":

rename 'old-name-dir' new-name-dir old-name-dir

To preview change type the "ls" command.

You can rename directory with the "mv" command:

mv old-name-dir/ new-name-dir

It will rename old-name-dir to new-name-dir. If old-name-dir contains any files, it is good advice add option -R after mv.

Was this information helpful to you? You have the power to keep it alive.
Each donated € will be spent on running and expanding this page about UNIX Shell.