在Unix中重命名多个文件 [英] Rename multiple files in Unix

查看:191
本文介绍了在Unix中重命名多个文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一个目录中有多个以fgh开头的文件,例如:

  fghfilea 
fghfileb
fghfilec

我想将它们全部重命名为前缀jkl。有没有一个单一的命令,而不是单独重命名每个文件?

$ c> rename 可能是最简单的。



使用 rename

重命名为s / ^ fgh / jkl /'fgh * 

使用另一个版本的 rename (与 Judy2K的回答):

  rename fgh jkl fgh * 

你应该检查你的平台的手册页,看看上面哪个适用。


There are multiple files in a directory that begin with prefix fgh, for example:

fghfilea
fghfileb
fghfilec

I want to rename all of them to begin with prefix jkl. Is there a single command to do that instead of renaming each file individually?

解决方案

There are several ways, but using rename will probably be the easiest.

Using one version of rename:

rename 's/^fgh/jkl/' fgh*

Using another version of rename (same as Judy2K's answer):

rename fgh jkl fgh*

You should check your platform's man page to see which of the above applies.

这篇关于在Unix中重命名多个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆