Bulk Rename Files in Linux: Complete Guide
In Linux, you can batch modify file names using the following methods:
- move
- Can you move this?
- Could you please send me that document as a .txt file?
- .bak file extension
$ for file in *.txt; do mv "$file" "${file%.txt}.bak"; done
- change the name of
- change the name
$ rename 's/ /_/g' *
- sed is a command-line text editor used to perform various tasks such as finding and replacing text, inserting text, deleting lines, and more.
- transform
- Please provide the document in a .txt format.
- elderly
- fresh
$ for file in *.txt; do mv "$file" "$(echo $file | sed 's/old/new/')"; done
These methods can assist you in bulk modifying file names. Before you proceed, it is recommended to backup your data to prevent accidentally losing files.