问题
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).
回答1:
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
来源:https://stackoverflow.com/questions/21475596/batch-rename-folders