# Sorting image files

**URL:** <https://forums.powershell.org/t/sorting-image-files/20311>\
**Category:** PowerShell Help\
**Created:** [August 30, 2022, 4:07pm UTC](https://forums.powershell.org/t/sorting-image-files/20311 "2022-08-30T16:07:36Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![marius1956](https://avatars.discourse-cdn.com/v4/letter/m/eada6e/32.png) [@marius1956](https://forums.powershell.org/u/marius1956)\
**Post date:** [August 30, 2022, 4:07pm UTC](https://forums.powershell.org/t/sorting-image-files/20311/1 "2022-08-30T16:07:36Z")

</div>

I have a folder containing several .jpg files.  
I need to sort them by “acquisition date” (in Italian: “data acquisizione”).  
How can I write the “Sort-Object” statement?  
Regards

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [August 30, 2022, 4:14pm UTC](https://forums.powershell.org/t/sorting-image-files/20311/2 "2022-08-30T16:14:49Z")

</div>

marius,  
Welcome back to the forum. 👋🏽 Long time no see.

> [@marius1956](#):
>
> I need to sort them by “acquisition date” (in Italian: “data acquisizione”).

Why / what for do you need that?  
Do you get this property when you run a `Get-ChildItem` on the folder?

---

<div class="post-metadata">

**Author:** ![marius1956](https://avatars.discourse-cdn.com/v4/letter/m/eada6e/32.png) [@marius1956](https://forums.powershell.org/u/marius1956)\
**Post date:** [August 30, 2022, 4:59pm UTC](https://forums.powershell.org/t/sorting-image-files/20311/3 "2022-08-30T16:59:21Z")

</div>

Yes, it’s exactly what I need…

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [August 30, 2022, 7:27pm UTC](https://forums.powershell.org/t/sorting-image-files/20311/4 "2022-08-30T19:27:39Z")

</div>

So what’s the issue? I don’t understand your question?

You may (re-)read the help completely including the examples to learn how to use it.

> **[Sort-Object (Microsoft.PowerShell.Utility) - PowerShell](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/sort-object?view=powershell-7.2)**
>
> The Sort-Object cmdlet sorts objects in ascending or descending order based on object property values. If sort properties are not included in a command, PowerShell uses default sort properties of the first input object. If the type of the input...

---

<div class="post-metadata">

**Author:** ![matt-bloomfield](https://avatars.discourse-cdn.com/v4/letter/m/dec6dc/32.png) [@matt-bloomfield](https://forums.powershell.org/u/matt-bloomfield)\
**Post date:** [August 30, 2022, 8:47pm UTC](https://forums.powershell.org/t/sorting-image-files/20311/5 "2022-08-30T20:47:01Z")

</div>

That property will be in the metadata. There is a function available to read the metadata, written by Ed ‘Scripting Guy’ Wilson:

> **[Use PowerShell to Find Metadata from Photograph Files](https://devblogs.microsoft.com/scripting/use-powershell-to-find-metadata-from-photograph-files/)**
>
> Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to obtain metadata from photo files.  Hey, Scripting Guy! I need some help. I have thousands of photo files on my computer. I need to bring some order to them.

The script is no longer online at the linked location but you can get it from [archive.org](http://archive.org)

> **[Script get file meta data function](https://web.archive.org/web/20201111223917/https://gallery.technet.microsoft.com/scriptcenter/get-file-meta-data-function-f9e8d804)**
>
>  This script uses the Shell.Application object to get file metadata. It returns the metadata as a custom PowerShell object, and therefore can be sorted and otherwise processed. It is a bit slow because it checks all 266 possible fields for data for...

You can then dot source the script, point it at the folder, and get at the data you need.

```auto
. .\Get-FileMetaDataReturnObject.ps1
Get-FileMetaData 'E:\Temp\Pics\' | Sort-Object 'data acquisizione' | Select-Object 'data acquisizione',Filename

```

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:16pm UTC](https://forums.powershell.org/t/sorting-image-files/20311/6 "2024-05-16T20:16:43Z")

</div>

Closed on May 16, 2024, 8:16pm UTC


