Author Topic: Renaming and Numbering Images in Multiple Folders  (Read 1831 times)

Alyssa

  • Full Member
  • ***
  • Posts: 54
Renaming and Numbering Images in Multiple Folders
« on: March 16, 2016, 01:50:57 PM »
Hello
I'm trying to numbering about 2.000 images in about 50 different folders, I tried some commands I found reading other threads and the Faq in
http://www.exiftool.org/filename.html#ex6
But the only working result was renaming all images to an incremental numbering sequence(e.g. first folder were named like 1 to 55 then in the next folder they were named like 56 to 102 and so on),which could be quite messy.

I'm simply trying to append Folder name to each file within(e.g. Folder "Chapter 1" to each Image "Chapter 1 - 001.jpg"/"Chapter 1 - 002.jpg" and so on),and numbering then sequentially but individually for each folder(so within each folder the numbering starts back from 001),also with a 3-digit numbering (e.g. 001,002,003 etc. instead of 1,2,3 etc.).

Off course renaming using existing alphabetical order(I've read I have to specify it with -fileorder directory -fileorder filename if that's correct),thanks.

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16703
    • ExifTool Home Page
Re: Renaming and Numbering Images in Multiple Folders
« Reply #1 on: March 16, 2016, 02:46:41 PM »
You want to keep the original file name and just append the folder name and a number, starting at 1 for reach folder?

This is tricky.  I would have to think about this.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Alyssa

  • Full Member
  • ***
  • Posts: 54
Re: Renaming and Numbering Images in Multiple Folders
« Reply #2 on: March 16, 2016, 02:49:25 PM »
No no, original filename doesn't matter,just the folder name and numbering(e.g. Folder Name-001;Folder Name-002;Folder Name-003;etc.)

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16703
    • ExifTool Home Page
Re: Renaming and Numbering Images in Multiple Folders
« Reply #3 on: March 16, 2016, 03:00:21 PM »
OK, this is easier then:

exiftool -fileorder filename "-filename<${directory;s(.*/)()}-%.3nc.%e" -r DIR

Try this writing "testname" instead of "filename" first to be sure it is doing what you want.
 
- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Alyssa

  • Full Member
  • ***
  • Posts: 54
Re: Renaming and Numbering Images in Multiple Folders
« Reply #4 on: March 16, 2016, 03:06:37 PM »
Tried with both filename and testname and only 1 file per folder was updated with names like:
...
Chapter 05-e
Chapter 06-e
etc.
(Files were without an extension).
All the updated files were the first ones(in alphabetical order) in each folder,all others files were untouched.

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16703
    • ExifTool Home Page
Re: Renaming and Numbering Images in Multiple Folders
« Reply #5 on: March 16, 2016, 03:07:59 PM »
All "%" characters must be doubled if you run this command from a .BAT file (FAQ 27)
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Alyssa

  • Full Member
  • ***
  • Posts: 54
Re: Renaming and Numbering Images in Multiple Folders
« Reply #6 on: March 16, 2016, 03:11:21 PM »
Oh right sorry  ;D its been a long time and I forgot about that.

Yeah now it works perfectly thanks  :)