If using bash, there’s no need for external commands like sed, basename, rename, expr, etc.
for file in *.html
do
mv "$file" "${file%.html}.txt"
done
More Related Contents:
- Renaming files in a folder to sequential numbers
- Batch renaming files with Bash
- Using sed to mass rename files
- How to rename with prefix/suffix?
- Get the Perl rename utility instead of the built-in rename
- How to Batch Rename Files in a macOS Terminal?
- How to zero pad numbers in file names in Bash?
- Renaming files with Bash, removing prefix and suffix
- Redirect stderr and stdout in Bash [duplicate]
- How to detect if a script is being sourced
- bash : Illegal number
- Delete files older than 10 days using shell script in Unix [duplicate]
- Remove Unicode characters from textfiles – sed , other Bash/shell methods
- How to replace an entire line in a text file by line number
- Simulating ENTER keypress in bash script
- Piping both stdout and stderr in bash?
- Why aliases in a non-interactive Bash shell do not work
- Using case for a range of numbers in Bash
- How to run some command before or after every Bash command entered from console?
- Script to get the HTTP status code of a list of urls?
- What is your single most favorite command-line trick using Bash? [closed]
- How can I print each command before executing? [duplicate]
- Using Bash to display a progress indicator (spinner) [duplicate]
- Can parameter expansion be nested in Bash? [duplicate]
- Looping over arrays, printing both index and value
- Temporarily change current working directory in bash to run a command [duplicate]
- Generating random number between 1 and 10 in Bash Shell Script [duplicate]
- How to break out of a loop in Bash?
- How to assign a glob expression to a variable in a Bash script?
- What’s the difference between “here string” and echo + pipe