I have about 2000 folders all named like this

dataul_-_ppfsefs

music_-_ppfsefs

fun [gghhhses]

pictures_-_ppfsefs

backup [gghhhses]

tempfiles_-_ppfsefs

trash_it_-_ppfsefs

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

dataul

music

fun

pictures

backup

tempfiles

trash_it


Edit: 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
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top