Home > System Tutorial > LINUX > How to use commands to batch modify file names under CentOS?

How to use commands to batch modify file names under CentOS?

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2024-01-05 08:09:05
forward
1275 people have browsed it

I encountered a new problem today. What if I want to cut off the suffixes in batches?

The specific commands are as follows:

find -name "*.txt" |for i in *;do mv $i `echo $i |sed 's/\.txt//g'`;done

find -name "*.txt" |awk -F'.' '{print $1} |xargs mv {}.txt {}

If you only want to modify the suffix name, use rename. The command is as follows:

rename .txt .bk *

The above is the detailed content of How to use commands to batch modify file names under CentOS?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template