dunryc
April 17, 2016, 1:42pm
1
HI guys here's hoping some on pout the can help
I have a large library of epub and mobi file creates some what by calibre.
Output of tree listing below
** Paddy Whacked_ The Untold Story of the Irish American Gangster (581)
** ** cover.jpg
** ** metadata.opf
** ** Paddy Whacked_ The Untold Story of the Iri - T. J. English.mobi
** The Savage City_ Race, Murder, and a Generation on the Edge (619)
** cover.jpg
** metadata.opf
** The Savage City_ Race, Murder, and a Gener - T. J. English.mobi
Tom Philbin
** Killer Book of Cold Cases_ Incredible Stories, Facts, and Trivia From the Most Baffling True Cr (570)
** cover.jpg
** Killer Book of Cold Cases_ Incredible Stor - Tom Philbin.epub
** Killer Book of Cold Cases_ Incredible Stor - Tom Philbin.mobi
** metadata.opf
Tony Bennett
** The Good Life (789)
** cover.jpg
** metadata.opf
** The Good Life - Tony Bennett.epub
** The Good Life - Tony Bennett.mobi
Trevor Marriott
** The Evil Within - a Top Murder Squad Detective Reveals the Chilling True Stories of the World's (572)
** cover.jpg
** metadata.opf
** The Evil Within - a Top Murder Squad Detec - Trevor Marriott.epub
** The Evil Within - a Top Murder Squad Detec - Trevor Marriott.mobi
Troy Denning
** Book 1 - A Forest Apart (737)
** ** Book 1 - A Forest Apart - Troy Denning.epub
** ** Book 1 - A Forest Apart - Troy Denning.mobi
** ** cover.jpg
I would like to recursively rename the directories removing the brackets and numbers
** Paddy Whacked_ The Untold Story of the Irish American Gangster
** ** cover.jpg
** ** metadata.opf
** ** Paddy Whacked_ The Untold Story of the Iri - T. J. English.mobi
** The Savage City_ Race, Murder, and a Generation on the Edge
** cover.jpg
** metadata.opf
** The Savage City_ Race, Murder, and a Gener - T. J. English.mobi
Tom Philbin
** Killer Book of Cold Cases_ Incredible Stories, Facts, and Trivia From the Most Baffling True Cr
** cover.jpg
** Killer Book of Cold Cases_ Incredible Stor - Tom Philbin.epub
** Killer Book of Cold Cases_ Incredible Stor - Tom Philbin.mobi
** metadata.opf
Tony Bennett
** The Good Life
** cover.jpg
** metadata.opf
** The Good Life - Tony Bennett.epub
** The Good Life - Tony Bennett.mobi
Trevor Marriott
** The Evil Within - a Top Murder Squad Detective Reveals the Chilling True Stories of the World's
** cover.jpg
** metadata.opf
** The Evil Within - a Top Murder Squad Detec - Trevor Marriott.epub
** The Evil Within - a Top Murder Squad Detec - Trevor Marriott.mobi
Troy Denning
** Book 1 - A Forest Apart
** ** Book 1 - A Forest Apart - Troy Denning.epub
** ** Book 1 - A Forest Apart - Troy Denning.mobi
** ** cover.jpg
I have been scratching my head over this one all day so any help would be gratefully appreciated
RudiC
April 17, 2016, 2:38pm
2
Any attempts beyond scatching your head?
dunryc
April 17, 2016, 2:49pm
3
yeah although i got a few splinters from the scratching
I can accomplish this fine with a line of text ie
give me the output i would like to rename to but how to apply this recursively to all directories is currently evading me
RudiC
April 17, 2016, 3:03pm
4
Try
find . -type d -name "*([0-9]*)" | while read FN; do echo mv $FN ${FN%([0-9]*)}; done
This doesn't check for three digits but allows for anything after the first digit; this may need some refinement. If the results comes close to what you need, remove the echo
for real action.
1 Like
dunryc
April 17, 2016, 3:37pm
5
rudic:
Try
find . -type d -name "*([0-9]*)" | while read FN; do echo mv $FN ${FN%([0-9]*)}; done
This doesn't check for three digits but allows for anything after the first digit; this may need some refinement. If the results comes close to what you need, remove the echo
for real action.
Thanks for the heads up had to add some inverted commas due to spaces in the names so
worked a treat