I have so many folders with (2)
at the end. But the Folders list is huge and it is not feasible to rename them individually. The only pattern is that all ends with (2)
as shown below. Is there a way to rename all of them by just removing the last (2)
.
Any help will be highly appreciable.
rename -n 's/ \(2\)$//' *
– muru Feb 16 '17 at 13:11(2)
and will keep other things same? – L.K. Feb 16 '17 at 13:12rename 's/ \(2\)$//' *
? – L.K. Feb 16 '17 at 13:14rename(John Shirley (2), John Shirley) rename(John Shors (2), John Shors) rename(John Steinbeck (2), John Steinbeck) rename(J. P. Donleavy (2), J. P. Donleavy) rename(J. Randy Taraborrelli (2), J. Randy Taraborrelli) rename(J. R. Moehringer (2), J. R. Moehringer) rename(J. R. R. Tolkien (2), J. R. R. Tolkien) rename(J. T. Ellison (2), J. T. Ellison) rename(J. V. Jones (2), J. V. Jones) rename(Last Argument of Kings (2), Last Argument of Kings)
. But no renaming with-n
– L.K. Feb 16 '17 at 13:17for i in *; do mv "$i" ${i%(2)}; done
works too. – BlueManCZ Feb 16 '17 at 13:31