Frage

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).

War es hilfreich?

Lösung

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
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top