1

A quick question... (Edited)

Year/Month/Day-Filename-001.jpg

  jhead -n%Y%m%d [(name)] 001 .jpg

(Not sure which options lets me create a filename after the year/month/day option in the usage documentation)

  • 1
    Please clarify your question. What format do you want the file's name to be? YYYY-MM-DD:HHMMSS.jpg, something like that? And you want to use the date information from the DateTimeOriginal tag in the EXIF data to do that? Is that correct? – scottbb Sep 17 at 12:24
  • @scottbb filename format: 2019_09_14-newname001.jpg, According to all images metadata on MacOS Finder, I want to use the modified date as the creation date when it was taken, the created date was overwritten with a recent date when transferring. Overwrite more than one image in a folder. – jcron12 Sep 19 at 1:34
  • Still unclear: when you say "I want to use the modified date as the creation date when it was taken", are you talking about the EXIF metadata inside the image files, or are you talking about the filesystem's file metadata (which every file has, including PDFs, Word docs, spreadsheets, text files, etc.)? – scottbb Sep 19 at 19:02
1

I want to overwriting more than one image and a number count “001”, “002” ect.

For the example you provided in a comment to tfb's answer, sequentializing the filenames breaks when you use the %f option. With multiple input files you'd get:

$ ls *.jpg
foo.jpg foo2.jpg
$ jhead -n"%Y_%m_%d-%f-newname001" *.jpg
 foo.jpg --> 2019_09_14-foo-newname001.jpg
 foo2.jpg --> 2019_09_14-foo2-newname001.jpg

But if you omit %f, and add %03i, you'll get the following:

$ ls *.jpg
foo.jpg foo2.jpg
$ jhead -n"%Y_%m_%d-newname-%03i" *.jpg
 foo.jpg --> 2019_09_14-newname-001.jpg
 foo2.jpg --> 2019_09_14-newname-002.jpg
  • Thankyou Scott! Ignore my previous comment above about MacOS, I tried your command now ` jhead -n"%Y_%m_%d-newname-%03i" .jpg` and it works great, I thought you needed a option “%*” to overwrite the filename but you just type it in. With the “%03i” option you can just add another 0 if you have images over 100 or 1000, correct?. I marked this as solved. Can I edit the title of this question to make it more clear for others when searching? Thanks for your help :-) – jcron12 Sep 20 at 3:42
  • @jcron12 Absolutely, %04i would produce 0001, 0002, etc. And yes, you can absolutely edit the question and/or title. Right below the text of the question, there are links to "share", "edit", "close", etc. Just click on "edit", and you can edit the title and the question text. – scottbb Sep 20 at 3:45
1

I'm not quite sure what you're after, but:

$ ls *.jpg
foo.jpg
$ jhead -n"%Y%m%d%H%M-%f-renamed" foo.jpg
foo.jpg --> 201909141339-foo-renamed.jpg
$ ls *.jpg
201909141339-foo-renamed.jpg

The usage documentation for jhead is quite good, and you might want to check the manual for strftime (if you're on a Unixoid system, which it looks like you are), which is where all of the time-and-date formatting stuff comes from. But note that jhead has some additional options, such as %f that I used above.

  • Thanks for answering, So from what I see, I can only use the existing filename assigned to a image but can’t overwrite with a new name at the end of the filename is what i wanted to achieve. – jcron12 Sep 18 at 0:57
  • I should’ve explained it more in the Original Post last night. So I edited your command to get what Im after, I want to overwriting more than one image and a number count “001”, “002” ect. but I don’t want hours & seconds. I’ll do another search on the usage documentation. So here’s what I think might work but havent tried yet. $ ls *.jpg foo.jpg $ jhead -n"%Y_%m_%d-%f-newname001" *.jpg foo.jpg --> 2019_09_14-newname001.jpg – jcron12 Sep 18 at 1:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.