topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday March 28, 2024, 12:52 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Problem Solved. (batch change of jpg 'created time')  (Read 11412 times)

Curt

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 7,566
    • View Profile
    • Donate to Member
Problem Solved. (batch change of jpg 'created time')
« on: May 18, 2017, 05:36 PM »
When I moved my files to this computer (x64 Windows 10 Home), I accidentally & unfortunately used a program that has erased almost all original info   and changed every jpg "Created Time". This is sad to me, because no matter how trigger happy I might be, I did not shoot 2150 pictures within a couple of minutes!

I realize I cannot recreate the original info or saved / created time, but I know I can copy each picture's "Last write"-time to also become its "Created"-time - and such a compromise is very okay in the situation (I don't care about camera info in general, other than when & where was the picture taken?) However, for now I can only do this one picture at a time - if I try to do it with more files, they have so far copied the same "time", or caused other problems. I need help to do this the proper batch way!

ChangeTime.jpgProblem Solved. (batch change of jpg 'created time')


Do 'you' know of a program that can do this? Or can & will 'you' write a script to make it happen?   
« Last Edit: May 19, 2017, 10:02 AM by Curt »

AbteriX

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 1,149
    • View Profile
    • Donate to Member
Re: help needed for batch change of jpg 'created time'
« Reply #1 on: May 19, 2017, 02:19 AM »
For Each JPG in folder --- Set "Created"-time from "Last write"-time


You can use PowerShell for that.

(First have a backup)




I will do it step by step for the learning effect:

Step1
Launch PoSh and change to your folder.

Step2
List the file(s) with Get-ChildItem and utilize Get-Member to see the object properties
(I have added select -First 1| because it is enough to see that info once only)

Get-ChildItem *.jpg | select -First 1 | Get-Member
(Short: ls *.jpg|gm)

You will see among others
CreationTime              Property       datetime CreationTime {get;set;}
LastAccessTime            Property       datetime LastAccessTime {get;set;}
LastWriteTime             Property       datetime LastWriteTime {get;set;}


Step3
Now lets see what that properties will get us
Get-ChildItem *.jpg | ForEach-Object{$_.CreationTime ; $_.LastWriteTime}
Donnerstag, 20. April 2017 16:25:27
Mittwoch, 19. Oktober 2005 01:18:56


Step4
Set Creation time from LastWriteTime
Get-ChildItem *.jpg | ForEach-Object{$_.CreationTime = $_.LastWriteTime}


Step5
Test, like in Step3
Get-ChildItem *.jpg | ForEach-Object{$_.CreationTime ; $_.LastWriteTime}
Mittwoch, 19. Oktober 2005 01:18:56
Mittwoch, 19. Oktober 2005 01:18:56



For you it's enough to perform Step4.
In short syntax:
dir *.jpg | %{$_.CreationTime = $_.LastWriteTime}

Or work on the first few only for testing purpose:
dir *.jpg |select -First 3| %{$_.CreationTime = $_.LastWriteTime}


Use '-Recurse' to work in sub folders too:
dir *.jpg -Recurse | %{$_.CreationTime = $_.LastWriteTime}



HTH?  :D

GCI is short for 'Get-ChildItem'
DIR and LS are aliases for 'Get-ChildItem'


.
« Last Edit: May 19, 2017, 02:27 AM by AbteriX »

Curt

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 7,566
    • View Profile
    • Donate to Member
Re: help needed for batch change of jpg 'created time'
« Reply #2 on: May 19, 2017, 03:45 AM »
1) I have never before seen Power Shell or Power Shell ISE. So no matter how grateful I might be that you're trying to help me, AbteriX, I have absolutely no idea what you just told me!  :-[

2) Power Shell will not navigate to C:\Users\Kurt\Pictures, but will strictly open at C:\Users\Kurt and go nowhere else. Any attempt to navigate elsewhere has so far resulted in "ObjectNotFound" & "CommandNotFoundException" or similar. So, back to basics: How do I navigate Power Shell?  :tellme:
« Last Edit: May 19, 2017, 08:01 AM by Curt »

tomos

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 11,959
    • View Profile
    • Donate to Member
Re: help needed for batch change of jpg 'created time'
« Reply #3 on: May 19, 2017, 04:12 AM »
Curt, [edit] see also next post [/edit] this old but might be of help -- I have used another app and posted about it here but could not find it :-(

revisiting this (correcting created date of photos) -
this about correcting the date in the Exif info if that incorrect.

From the current newsletter (Nov.6th 2009) from Imaging Resource. I added a link for the recommended app in the quote:-
camera manufacturers record it in the Exif header of their image files in several places. The DateTimeOriginal, CreateDate and ModifyDate tags all record it, for example. The trick is to reset all three on a new image.

ExifTool can do that with one simple command. There's a Windows version and a Mac version. The simplest way to use the utility is from the command line (Terminal on the Mac).
[...]
   exiftool -AllDates-=1 *
Full article: http://www.imaging-r...v11/20091106.htm#adv

I do have a GUI (portable) for that:
the only info in the about box is:
---------------------------
Information
---------------------------
ExifToolGUI v3.42 by Bogdan Hrastnik
Freeware interface for Exiftool
ExifTool by Phil Harvey v8.35
jhead.exe=missing,  jpegtran.exe=missing
---------------------------
Tom

tomos

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 11,959
    • View Profile
    • Donate to Member
Re: help needed for batch change of jpg 'created time'
« Reply #4 on: May 19, 2017, 04:14 AM »
this the one I used for the job: again old, but might still do the job:

here are two more tools that will be useful in this task.

http://www.sentex.net/~mwandel/jhead/
http://jpgtime.learsy.com/
that Learsy one is a thing of beauty :Thmbsup:



# no install
# simple to use -
  • select files (all if you want) / click Set time from EXIF - it show the Exif time in the "New Time" column
  • compare
  • select those you want to change
  • click Apply changes

then go off and donate to the author (donationware :up:)
http://www.muralpix.com/donation.html
Tom

AbteriX

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 1,149
    • View Profile
    • Donate to Member
Re: help needed for batch change of jpg 'created time'
« Reply #5 on: May 19, 2017, 05:02 AM »
How do I navigate Power Shell?  :tellme:

If this is still need, here is how:

- Open PowerShell window ( Run: powershell )
- You will get a PowerShell window, starting in your profile directory
C:\Users\Kurt\

- now tell the machine you want to change the folder:
use 'Set-Location', short 'SL', or the alias, know from DOS days: 'CD'
cd

- add a space after CD

- net start typing 'pic' and press TAB key to cycling  through all matching folders (if any), and you will get:
cd .\Pictures

- press Enter
C:\Users\Kurt\Pictures



- - -

Extra tip:
- use TAB key everywhere and every time in PoSh to aid you navigating
- press Ctrl+C to cancel current typed command and get a new line
- Type 'cd ..' + ENTER to go to parent directory
- Type 'cd \' + ENTER to go to the root of a drive
- Type 'H:' + ENTER to switch to drive with letter H
- Type 'cd ~' + ENTER to switch to your home directory C:\Users\Kurt\
- Type 'cd ~\' + TAB to cycling  through all folders


Here is a better explanation
http://programminghi.../intro-to-powershell


HTH?  :Thmbsup:
 
« Last Edit: May 19, 2017, 05:11 AM by AbteriX »

ConstanceJill

  • Supporting Member
  • Joined in 2012
  • **
  • Posts: 205
    • View Profile
    • Donate to Member
Re: help needed for batch change of jpg 'created time'
« Reply #6 on: May 19, 2017, 06:10 AM »
Hello there .o/

When I moved my files to this computer (x64 Windows 10 Home), I accidentally & unfortunately used a program that has erased almost all original info   and changed every jpg "Created Time".
The way I understand it, the "created time" is when space was first reserved on the drive to write the file to it. So it would be normal behaviour, not an issue related to the program you used to perform the copy.

Anyway…
Do 'you' know of a program that can do this? Or can & will 'you' write a script to make it happen?   
I actually remember making such a batch script a few years back, which made use of a freeware command line tool named smarttimestamp (available on Softpedia : http://www.softpedia...mart-Timestamp.shtml but you should probably use the latest version from https://sites.google...ralev/smarttimestamp )
I'll try to find it when I get back home (currently at work) and to remember to post it here :]

Edit : after re-reading the thread from back then (here, in french), you don't even need to make a whole script :
smarttimestamp . *.jp* /cd-modified /ct-modified
shoud do it.
« Last Edit: May 19, 2017, 06:21 AM by ConstanceJill »

Curt

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 7,566
    • View Profile
    • Donate to Member
Re: help needed for batch change of jpg 'created time'
« Reply #7 on: May 19, 2017, 08:37 AM »
I am very grateful for your help, AbteriX, tomos, ConstanceJill. Thank you! It has been a pleasure to read your responses and TRY to do as you said. In the end, what was the easiest way was to follow ConstanceJill's link to smarttimestamp and simply place smarttimestamp.exe in /Pictures. I then did a "Command Line from here", pasting smarttimestamp . *.jp* /cd-modified /ct-modified. A second later, the job was done!

Thank you!  :up:

Post modified:
-----------
One must first remove write-protection from the picture files, otherwise smarttimestamp will simply stop at the first protected file.
« Last Edit: May 19, 2017, 09:59 AM by Curt »

tomos

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 11,959
    • View Profile
    • Donate to Member
Re: help needed for batch change of jpg 'created time'
« Reply #8 on: May 19, 2017, 08:45 AM »
^ Very good: Bookmarked

Also interesting to learn a bit about using the command line from Abterix :up:
Tom

Curt

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 7,566
    • View Profile
    • Donate to Member
Re: Problem Solved. (batch change of jpg 'created time')
« Reply #9 on: May 19, 2017, 10:08 AM »
HTH?  :D

Why does AbteriX keep asking How The Hell without finishing the question?
I am not trying to be funny... hehehe... but the biggest kitchen manufacturer in Denmark is named HTH, so search answers in Danish are not explaining this HTH

tomos

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 11,959
    • View Profile
    • Donate to Member
Re: Problem Solved. (batch change of jpg 'created time')
« Reply #10 on: May 19, 2017, 10:49 AM »
I am not trying to be funny... hehehe...
but you're laughing so we cant be sure :P

just in case:
Hope that helps
Tom

DonL

  • Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 171
    • View Profile
    • XYplorer File Manager
    • Donate to Member
Re: Problem Solved. (batch change of jpg 'created time')
« Reply #11 on: May 30, 2017, 11:45 AM »
Hmm, I thought you guys here know XYplorer? :huh: Would have been a snap. It's built for such tasks. Pity I saw this too late. :-\

Curt

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 7,566
    • View Profile
    • Donate to Member
Re: Problem Solved. (batch change of jpg 'created time')
« Reply #12 on: May 30, 2017, 04:27 PM »
^no, DonL, you didn't see it "too late".

the easiest way was to place smarttimestamp.exe in /Pictures. I then did a "Command Line from here", pasting smarttimestamp . *.jp* /cd-modified /ct-modified. A second later, the job was done!

I have a lifetime key for the program you spoke about, but I haven't cared to install the app ever since the purchase + a month or so. Further more, Explorer has "everything".

By the way, we have a thread where you freely can tell about your programs. But you know that.

tomos

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 11,959
    • View Profile
    • Donate to Member
Re: Problem Solved. (batch change of jpg 'created time')
« Reply #13 on: May 30, 2017, 04:48 PM »
^ @Curt, why the snarkiness :tellme:
I'm not going to 'defend' the software -- and dont think anyone else needs to either -- suffice to say it's damn good. And this *is* a software forum - why shouldn't a software author post about their software :-/

Tom

wraith808

  • Supporting Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 11,186
    • View Profile
    • Donate to Member
Re: Problem Solved. (batch change of jpg 'created time')
« Reply #14 on: May 30, 2017, 04:51 PM »
^ @Curt, why the snarkiness :tellme:
I'm not going to 'defend' the software -- and dont think anyone else needs to either -- suffice to say it's damn good. And this *is* a software forum - why shouldn't a software author post about their software :-/



Agreed.  Especially since he was posting it as a solution to the thread, and it's a viable solution.

DonL

  • Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 171
    • View Profile
    • XYplorer File Manager
    • Donate to Member
Re: Problem Solved. (batch change of jpg 'created time')
« Reply #15 on: May 31, 2017, 02:02 AM »
OK, to leave something more useful than a sigh, here is the line that does the job in XYplorer (sets the created date of each selected item to that item's modified date):

timestamp "c", "*", , "m";

For one-time usage you can paste that line into the address bar and press Enter.

(Obviously, if you need the reverse job, simply swap "c" and "m".)

Curt

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 7,566
    • View Profile
    • Donate to Member
Re: Problem Solved. (batch change of jpg 'created time')
« Reply #16 on: May 31, 2017, 11:17 AM »
I was annoyed and took it out on DonL. As simple as that. Sorry, DonL. Why not tell us how to use XYplorer to solve the initial problem? Oh, you have:

OK, to leave something more useful than a sigh, here is the line that does the job in XYplorer (sets the created date of each selected item to that item's modified date):

timestamp "c", "*", , "m";

For one-time usage you can paste that line into the address bar and press Enter.

(Obviously, if you need the reverse job, simply swap "c" and "m".)

^But what is that? How can you suggest that this in any way should be easier than what I already had described solved the problem? No, I knew it right from the beginning: The business man was only looking for a way to promote his (otherwise excellent) program - Yes, it is excellent, I bought a lifetime key, didn't I. DonL could easily have made me happy. All he should do was to say "if another time, and if you have XYplorer, it can also do this". But he didn't. So I got annoyed. That's it.

cranioscopical

  • Friend of the Site
  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 4,776
    • View Profile
    • Donate to Member
Re: Problem Solved. (batch change of jpg 'created time')
« Reply #17 on: May 31, 2017, 08:57 PM »
"if another time, and if you have XYplorer, it can also do this"

Gosh! That's not your usual way, Curt.

If another time you feel this way, and if you have the foresight, you can also think the best of someone who tries to help ;)

 

Curt

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 7,566
    • View Profile
    • Donate to Member
Re: Problem Solved. (batch change of jpg 'created time')
« Reply #18 on: June 01, 2017, 03:42 AM »
no, you're right, cranioscopial, it's not my style at all. Thanks for noticing! The weather outside is nice, the weather inside is not; here's a storm raging: I might leave my club! After 35 years of loyalty, this is too big for my body. All day long, I feel so sad. But it has nothing to do with DC, so why take it out on DL? Hm...:

Sorry, DonL!  :-[



DonL

  • Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 171
    • View Profile
    • XYplorer File Manager
    • Donate to Member
Re: Problem Solved. (batch change of jpg 'created time')
« Reply #19 on: June 01, 2017, 04:23 AM »
You're welcome. :Thmbsup:

Curt

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 7,566
    • View Profile
    • Donate to Member
Re: Problem Solved. (batch change of jpg 'created time')
« Reply #20 on: June 01, 2017, 09:39 AM »
You're welcome.

^thanks! And you can say welcome, because you joined DC almost 4 months before me..., 11 years ago!  :D


DonL

  • Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 171
    • View Profile
    • XYplorer File Manager
    • Donate to Member
Re: Problem Solved. (batch change of jpg 'created time')
« Reply #21 on: June 01, 2017, 09:44 AM »
But you seem to have spent a couple of more hours here... :)