During the summer I was handed a delicate task for the book: “… and also, if you could hand us all the images in the book, thank you very much. Oh yeah, if you could name them CH01_01.png, CH01_02.png etc it would be great.”
Yes I felt a bit like:
Since Kanban In Action now have 13 chapters in different .doc-files I
immediately realized two things:
- Marcus - your are stupid for not tracking these images somewhere
- This is to big to do manually
This post describes how I did. It took me about 2 hours all together.
### Export all files in a Word document
The chapters are written in .doc formats (for some reason), but I seem
to recall that the newer format .docx in reality is just a
zip-file. Maybe, just maybe, that could help me.
1. I "Save as..."'ed the file to .docx.
2. Then I renamed the file to .zip and extracted the archive to a
folder.
3. Low and behold; in the \[Name of your word
document\]/word/media-folder all the images were listed. In the
order they appeared in the document.
The only downside, if you could call it that, was that the files were
named: image1.png, image2.png etc. That was the task up next:
### Renaming a lot of files (on OSX)
I now had all the files from all the documents, in separate folders.
That amounted to about 300 pictures. Yeah -
Kanban in
Action is graphic-heavy!
300 pictures is way more than I care to rename by hand. Remember that
they wanted each file to be named \[chapter
number\]\_\[sequence number in chapter\].png. I then found this awesome video that shows how to do that with
Automator.
Here are the steps I ended up
using:
1. Start Automator
2. Choose New-\>Application
3. Search for "Rename Finder Items" and click OK
4. Select "Don't add" in the dialog that ask you if you want to create
copies of the file. I didn't since I wanted to rename them
5. In the drop down select "Replace text" and do your replacement
settings. Here are my example:
6. Save the application to a wellknown place, for example the desktop.
You have now created a little renamer application. To it you can drag
the files you want to rename and ... presto - they will be ranamed.