批量重命名文件夹 [英] Batch rename folders

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

问题描述

我大约有2000个文件夹,都这样命名

I have about 2000 folders all named like this

dataul _-_ ppfsefs

dataul_-_ppfsefs

music _-_ ppfsefs

music_-_ppfsefs

乐趣[ghhhhses]

fun [gghhhses]

pictures _-_ ppfsefs

pictures_-_ppfsefs

备份[gghhhses]

backup [gghhhses]

tempfiles _-_ ppfsefs

tempfiles_-_ppfsefs

trash_it _-_ ppfsefs

trash_it_-_ppfsefs

名称"_-_ ppfsefs"和"[gghhhses]"结尾处有两个多余的部分,如何将它们重命名为这样

There are two unwanted portion at the end of the name "_-_ppfsefs" and " [gghhhses]", How to I rename them to look like this

数据

音乐

乐趣

图片

备份

临时文件

trash_it

我在Mac OSX上(已安装brew,macports).

I'm on Mac OSX (installed brew, macports).

推荐答案

以下两个命令应该可以做到:

The following two commands should do it:

for dir in * ; do mv "${dir}" "${dir/_-_ppfsefs/}" ; done

for dir in * ; do mv "${dir}" "${dir/ [gghhhses]/}" ; done

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

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