Directory

How to Change File Names for CoreSource Using a Mac

When ingesting files into the CoreSource DAM, you must follow a specific naming convention for all your assets. We know that renaming your files individually can be a big pain in your neck, so for you Mac users, we’ve written a couple of scripts that will take the hassle out of naming your two most common assets: your EPUBs and your ebook covers.

Let’s get on with it

1. First, download these two scripts we made just for you.

2. Now, create a directory (a folder) on your computer. It can be called anything, but we will call it ebooks for this how-to.

3. Inside that directory, create another directory called output. (Just like that: all lowercase.)

4. Place the two scripts you just downloaded in the top-level ebooks directory.

5. Place your EPUBs and cover images in the top-level ebooks directory. All of your EPUBs and JPG cover images should be named the eISBN, for example: 9780000000000.epub, 9780000000000.jpg.

Checking in

Are your EPUBs in the ebook folder? And your covers? This is what your directory should look like:
Directory

It should have all the scripts, any files you want to rename, and the output directory, all in this configuration.

Important warning:

There is no undo in Terminal. Before you go farther, make sure your EPUB and cover files all have backups!

Renaming your files

1. Once you’re set up, open Terminal (this will be in Applications>Utilities).

2. Change your directory in Terminal. Type cd  (that’s cd with a space after it) and drag and drop the directory from Finder into the Terminal. That will automatically insert the path to the directory in the Terminal. It should look something like this:
Terminal window with ebooks directory open
Hit enter and you should be in the new directory.
Terminal

3. Now we need to change the permissions on the scripts so that your computer is allowed to run them as programs. You only have to follow this step the first time you use your computer to rename files. After that you’ll be set up forever.

In your terminal, type or cut/paste the following line: chmod a+x rename.sh Once you have input this and hit enter, it should look like nothing happened.
Terminal
That means it worked!

4. Do the same for the renamejpg.sh chmod a+x renamejpg.sh Again, it should look like nothing happened. But thanks to the magic of Terminal, you’re now able to run the scripts.

5. Now all you need to do is type in the following, all in lowercase. Make a hard return after each line. for i in *.epub
do
./rename $i
done
After this, the terminal should display a list of ISBNs of the EPUBs you renamed. The EPUBs themselves should have been removed from the ebook top-level directory and into to output folder.

Here is what the Terminal should look like after you’ve finished running the script:
Terminal

And here is what your directory should look like:
Directory

6. Do the same for the images. This script is for JPGs. for i in *.jpg
do
./renamejpg $i
done
Again, you should see a list of ISBNs in the terminal, and the JPGs moved into the output directory with the suffix _FC appended to the ISBN.

Voila

From here you should not have any problems ingesting files into CoreSource.

  • Click here to download a guide to naming all your asset types for the CoreSource DAM. (Right click or option-click the link and choose “Save As…” to download this file.)
  • Want to know more about managing your files for CoreSource? Check out What is a Work Identifier.