简体   繁体   中英

renaming a bunch of files in bash

I have a few files in 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.

I have tried this, but it doesn't rename anything:

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

The syntax you're using is for Debian rename. Red Hat rename uses a completely different syntax.

rename _foo _bar _foo*.php

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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