rename all files in directory linux code example
Example 1: bash how to change all filenames in a directory
# Basic syntax using rename:
rename filename_search_expression replacement_text file_search
# For every file returned with file_search, if filename_search_expression
# is present in the file name, it will be changed to replacement_text
# Example usage:
# Given two files named:
this_is_an_example_filename.txt
example_filename_this_is.txt # Yoda phrasing
rename example_filename other_filename *.txt # Changes filenames to:
this_is_an_other_filename.txt
other_filename_this_is.txt
Example 2: rename all files starting with in linux
$ mmv '*abc*' '#1xyz#2'