Getting actual file creation date as text string

Welcome Forums General PowerShell Q&A Getting actual file creation date as text string

Viewing 2 reply threads
  • Author
    Posts
    • #196394
      Participant
      Topics: 1
      Replies: 1
      Points: 14
      Rank: Member

      I plugged an iPhone into the USB port of my Windows 10 laptop and copied 300+ files into directory "Foo" on my hard drive. I did this with Windows Explorer CopyAll and Paste. The list view of "Foo" shows the actual creation date of each .JPG file (some going back 6 years).
      But nothing I've tried in either PowerShell or the old CMD window lets me see these same creation dates. All the things I've tried show more recent dates (e.g. date of last access, date the files were copied into "Foo" from the iPhone, etc.).

      In Windows Explorer, I see the file info under headings

      Name                        Date                     Type                 Size

      A typical line reads

      TPLU8319.JPG    2/9/2014           JPEG image     1,133 KB

      Clearly the creation date (e.g.  2/9/2014) resides somewhere on my hard drive, but I don't see a way to get these dates into text strings that I can manipulate in a script, etc.

      I'd appreciate any advice/suggestions. Thanks in advance. Tom

    • #196508
      Participant
      Topics: 2
      Replies: 1693
      Points: 3,368
      Helping Hand
      Rank: Community Hero

      Clearly the creation date (e.g. 2/9/2014) resides somewhere on my hard drive,

      Hmmm ... yes and no. 😉 Digital images have meta data contained in the code in the files and if it's a common or well known format your Windows knows how to extract some of this meta data. That's what you see in the Explorer. Powershell is not able to read those meta data from images out of the box. You will have to find a module what adds this ability or write something by yourself.

      Regardless of that: When you post code please format it as code. That's valid for error messages or example data as well.
      Thanks in advance

    • #196565
      Participant
      Topics: 1
      Replies: 1
      Points: 14
      Rank: Member

      Thank you Olaf. I assumed (incorrectly) that Windows Explorer was displaying a date that was associated with each file, rather than a date within the files themselves. Since I have NTFS, I was thinking I could get the dates I want from the Master File Table — but I can't.

      The solution to my problem is to use a utility that extracts the date on which each photograph was taken (and other information) from JPG file headers. The free "jhead" utility does this.  See  https://www.sentex.ca/~mwandel/jhead/

      Thanks again — Tom

       

Viewing 2 reply threads
  • You must be logged in to reply to this topic.