Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Use the rename command of linux to change the file name in batch

2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces the use of linux rename command batch change file name, the text is very detailed, has a certain reference value, interested friends must read!

The rename command changes file names in batches using string substitutions.

Original string: The string whose filename needs to be replaced;

Target string: Replace the original characters contained in the file name with the target string;

Files: Specifies the list of files whose names you want to change.

Syntax format: rename [parameter]

Common parameters:

? Can replace a single character * Can replace multiple characters

Reference Example

Rename main1.c to main.c:

[root@linuxcool ~]# rename main1.c main.c main1.c

Rename all files ending in jpg to files ending in png:

[root@linuxcool ~]# rename .jpg .png *.jpg

The folder contains these files: foo1, …, foo9, foo10, …, foo163, rename the files foo1 to foo9 to foo01 to foo09:

[root@linuxcool ~]# rename foo foo0 foo?

Rename all files foo01 to foo99 to foo001 to foo099:

[root@linuxcool ~]# rename foo foo0 foo??

Rename all files foo001 to foo163 to foo0001 to foo0163:

[root@linuxcool ~]# rename foo foo0 foo*

Rename all files foo0100 to foo0163 to foo100 to foo163:

[root@linuxcool ~]# rename foo0 foo0[1]* The above is all the contents of using the Linux rename command to change file names in batches. Thank you for reading! Hope to share the content to help everyone, more relevant knowledge, welcome to pay attention to the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report