문제

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