Divide photos into folders

Welcome Forums General PowerShell Q&A Divide photos into folders

Viewing 11 reply threads
  • Author
    Posts
    • #274110
      Participant
      Topics: 1
      Replies: 6
      Points: 26
      Rank: Member

      Hi everyone, I have a folder with a lot of photos. I would like to be able to divide them into subfolders that have as their name the date of acquisition of the photos. Is it possible to have a powershell?

       

      Thanks.

    • #274128
      Participant
      Topics: 5
      Replies: 261
      Points: 1,036
      Helping Hand
      Rank: Community Hero

      Absolutely possible.  Here’s where I would start.  Do Get-Help on the following:

      Get-Item

      Get-ChildItem

      Get-ItemProperty

      Copy-Item

      New-Item

      Come back with some code and maybe I can help you out.

      • This reply was modified 2 months ago by Mike R..
    • #274143
      Participant
      Topics: 1
      Replies: 6
      Points: 26
      Rank: Member

      date of acquisition

      Hi, I have this:

      gci | ? {-not $_.psiscontainer} | % {$_.creationtime.tostring(‘yyyy-MM-dd’)} | sort -unique | % {new-item -type directory $_}

      $files = gci | ? {-not $_.psiscontainer}

      $folders = gci | ? {$_.psiscontainer}

      foreach ($file in $files) {foreach($folder in $folders) {if($file.creationtime.tostring(‘yyyy-MM-dd’) -eq $folder) {move-item $file.fullname -destination $folder}}}

       

      It work fine, but it doesn’t use the date of acquisition

    • #274149
      Participant
      Topics: 5
      Replies: 261
      Points: 1,036
      Helping Hand
      Rank: Community Hero

      What is the “date of aquisition”?  File objects have the following date properties:

      Name
      —-
      CreationTime
      CreationTimeUtc
      LastAccessTime
      LastAccessTimeUtc
      LastWriteTime
      LastWriteTimeUtc

      Is it one of these?

    • #274155
      Participant
      Topics: 1
      Replies: 6
      Points: 26
      Rank: Member

      What is the “date of aquisition”? File objects have the following date properties:

      Name

      —-

      CreationTime

      CreationTimeUtc

      LastAccessTime

      LastAccessTimeUtc

      LastWriteTime

      LastWriteTimeUtc

      Is it one of these?

      In windows 10 (Italian) I can sort the files by date, creation date and acquisition date. Only the date of acquisition shows the true date the photos were taken.

    • #274158
      Participant
      Topics: 17
      Replies: 1957
      Points: 4,015
      Helping Hand
      Rank: Community Hero

      Date the picture was taken is metadata:

      Use PowerShell to Find Metadata from Photograph Files

    • #274161
      Participant
      Topics: 1
      Replies: 6
      Points: 26
      Rank: Member

      Date the picture was taken is metadata:

      Use PowerShell to Find Metadata from Photograph Files

      <iframe width=”600″ height=”338″ style=”position: absolute; clip: rect(1px, 1px, 1px, 1px);” class=”wp-embedded-content” sandbox=”allow-scripts” security=”restricted” title=”“Use PowerShell to Find Metadata from Photograph Files” — Scripting Blog” src=”https://devblogs.microsoft.com/scripting/use-powershell-to-find-metadata-from-photograph-files/embed/#?secret=puQCzcL6sq&#8221; data-secret=”puQCzcL6sq” frameborder=”0″ marginwidth=”0″ marginheight=”0″ scrolling=”no” data-mce-fragment=”1″></iframe>

      Hi, could you modify my powershell to make it work? I am just starting out!

      • This reply was modified 2 months ago by Mauco8045.
    • #274179
      Participant
      Topics: 1
      Replies: 6
      Points: 26
      Rank: Member

      Date the picture was taken is metadata:

      Use PowerShell to Find Metadata from Photograph Files

      <iframe width=”600″ height=”338″ style=”position: absolute; clip: rect(1px, 1px, 1px, 1px);” class=”wp-embedded-content” sandbox=”allow-scripts” security=”restricted” title=”“Use PowerShell to Find Metadata from Photograph Files” — Scripting Blog” src=”https://devblogs.microsoft.com/scripting/use-powershell-to-find-metadata-from-photograph-files/embed/#?secret=puQCzcL6sq&#8221; data-secret=”puQCzcL6sq” frameborder=”0″ marginwidth=”0″ marginheight=”0″ scrolling=”no” data-mce-fragment=”1″></iframe>

      In the folders I have .jpg and .raw files. From the .raw files I don’t think you can find the date from the metadata.

    • #274185
      Participant
      Topics: 5
      Replies: 349
      Points: 632
      Helping Hand
      Rank: Major Contributor
    • #274425
      Participant
      Topics: 1
      Replies: 6
      Points: 26
      Rank: Member

      Hi, thank you. As I said, for each photo I have 2 files… namephoto.jpg and namephoto.cr2. Is it possible to move all this files?

    • #274605
      Participant
      Topics: 5
      Replies: 349
      Points: 632
      Helping Hand
      Rank: Major Contributor

      My edit should work for both file formats

    • #274764
      Participant
      Topics: 1
      Replies: 6
      Points: 26
      Rank: Member

      $folder = \\path\to\photos

      Hi, thanks for the script. I wanted to ask you if I have to add the folder where it finds the files or if it is enough to put the script in the working folder.

       

      Thank you

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