简体   繁体   English

重命名bash中的一堆文件

[英]renaming a bunch of files in bash

I have a few files in linux: 我在linux中有一些文件:

_foo_1.php
_foo_2.php
_foo_3.php

I want to rename them all from _foo to _bar, preserving the rest of the filename. 我想将它们全部从_foo重命名为_bar,保留其余的文件名。

I have tried this, but it doesn't rename anything: 我已经尝试过了,但是它没有重命名:

rename 's/_foo/_bar/' *.php

The syntax you're using is for Debian rename. 您使用的语法用于Debian重命名。 Red Hat rename uses a completely different syntax. Red Hat重命名使用完全不同的语法。

rename _foo _bar _foo*.php

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM