Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Editor

Notices

Reply
 
Thread Tools Search this Thread
Old 04-15-2018, 01:05 AM   #1
luckylittle
Member
luckylittle began at the beginning.
 
Posts: 11
Karma: 10
Join Date: Nov 2012
Device: Kindle Fire
Lightbulb Change the file extension of the selected files

I have a renaming problem:

I've got folders/books which consist of many little files without an extension (but in fact they are valid XHTML) and these files are already linked between each other (for example index_file points to sec1_file & sec2_file; sec3_file_chapter2 links to sec1_file etc.)

When i import these files into Calibre Ebook Editor, they end up in Miscellaneous folder. So i add XHTML extension to these files outside of Calibre and import them this way and they show up in Text.

But for links to be working, i need to then rename them back inside the Text folder to files without an extension sec1_file.xhtml to sec1_file. If i do that one by one, it is very time consuming, but the result is excellent.

Suggestions:
  • In the "Change the file extensions of the selected files" dialog - ability to remove the extension (when the "New file extension:" is empty, it removes the extension), or
  • Leverage "Find/Replace" dialog for "Bulk rename the selected files", there could be another option "Filenames" in "Where to search/replace" dialog.
  • Ability to drag and drop from Miscellaneous to Text
luckylittle is offline   Reply With Quote
Old 04-15-2018, 01:11 AM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,856
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
I'm afraid your use case is too niche for me to add support for it to the editor. I suggest you simply rename them outside the editor then import and use a search and replace regex to fix the links automatically.
kovidgoyal is offline   Reply With Quote
Advert
Old 04-15-2018, 02:50 AM   #3
luckylittle
Member
luckylittle began at the beginning.
 
Posts: 11
Karma: 10
Join Date: Nov 2012
Device: Kindle Fire
Arrow Feedback

Hi,

Thanks so much for your reply, i really appreciate your hard work and dedication!

Actually it is not that niche at all. Look at these files inside the retail ebook that was released last week:

Quote:
01_praise_xhtml
02_half_title_xhtml
03_full_title_xhtml
04_copyright_xhtml
05_content_xhtml
06_figures_xhtml
07_foreword_1_xhtml
08_foreword_2_xhtml
09_quick_xhtml
10_preface_xhtml
11_part_1_xhtml
12_ch1_xhtml
13_ch2_xhtml
14_ch3_xhtml
15_ch4_xhtml
16_ch5_xhtml
17_ch6_xhtml
18_ch7_xhtml
19_ch8_xhtml
20_ch9_xhtml
21_ch10_xhtml
22_ch11_xhtml
23_part2_xhtml
24_ch12_xhtml
25_ch13_xhtml
26_ch14_xhtml
27_ch15_xhtml
28_part3_xhtml
29_ch16_xhtml
31_conclusion_xhtml
32_app_a_xhtml
33_app_b_xhtml
34_app_c_xhtml
35_ackno_xhtml
36_biblio_xhtml
37_index_xhtml
38_about_xhtml
toc_html
No extensions.

It would be great, if this dialog:


Was working as i would expect - if i don't put anything in there and hit "OK", it should remove the extension(s), or ask me if i want to remove it.
At the moment, both of the buttons work the same way if the dialog is empty.
luckylittle is offline   Reply With Quote
Old 04-15-2018, 03:04 AM   #4
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,856
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
I really dont see why anyone would want to remove extensions. Sure there are likely a few broken books out there without extensions, that does not mean removing them from files where they are present is a good idea.
kovidgoyal is offline   Reply With Quote
Old 04-15-2018, 03:47 AM   #5
luckylittle
Member
luckylittle began at the beginning.
 
Posts: 11
Karma: 10
Join Date: Nov 2012
Device: Kindle Fire
Question

Could you at least point me to the right file on Github that is related to this change the extension function? I will create a plugin for myself.
luckylittle is offline   Reply With Quote
Advert
Old 04-15-2018, 03:51 AM   #6
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,856
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Simply search for the text in that dialog and you will find the file.
kovidgoyal is offline   Reply With Quote
Old 04-15-2018, 04:00 AM   #7
luckylittle
Member
luckylittle began at the beginning.
 
Posts: 11
Karma: 10
Join Date: Nov 2012
Device: Kindle Fire
In case if someone else will be looking into the same things in the future, the code is here.
luckylittle is offline   Reply With Quote
Reply

Tags
extension, filename, rename, renaming


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
I want to change only the file extension BTskj Plugins 0 08-06-2017 11:04 AM
bulk change file extension, but not name Fedwin Sigil 33 03-14-2015 05:51 AM
File name syntax change, existing files? martienne Library Management 5 02-09-2014 08:48 AM
SSModeSwitcher: An extension to change Screensaver mode thomass Kindle Developer's Corner 13 11-04-2012 09:31 PM
Troubleshooting file extension gerry7 Amazon Kindle 1 05-25-2011 06:55 AM


All times are GMT -4. The time now is 07:26 PM.


MobileRead.com is a privately owned, operated and funded community.