Organizing Photos Using PowerShell Instead of DropIt

Is there a PowerShell script that will look at a .jpg Date, Date Created, Date Taken, Date Modified, Date Accessed, Date Aquired and Date Last Saved and IF they are not blank, take the oldest date and make a folder like 20080515 (yyyymmdd) and then move the .jpg to that folder?

I am doing this manually for thousands of .jpgs and it is very time consuming.

I have DropIt but it will only handle Date Created, Date Modified, Date Opened (I guess this is Date Accessed) and Date Taken. Also when I use DropIt on Date Taken, even though I select .jpg with non-blank Date Taken, it creates a folder 000 and puts everything there ignoring the Date Taken date.

I am finding on my .jpgs that if I use the oldest date in any of these fields, 90% of the time this is correct date for the photo and it makes it easy to figure out where the photo was taken, event, etc.

I wish I could do these with .png files, but they do not seem to have a lot of meta info.

I am new to PowerShell but I see it can do a lot in Windows.

Thank you!


Welcome back to the forum. :wave:t3: Long time no see. :slightly_smiling_face:

Since these are pretty specific requirements I’d doubt that.

If you have to work with meta data from image files you may take a look to the de facto standard tool for those purposses …

AFAIK there is no built in way for PowerShell to work with image file meta data.

In Windows File Explorer, all of these columns can be added by going to any folder, View > Details and then right-clicking in the column heading area and selecting More… Then just check the checkbox next to each of these: Date, Date Created, Date Taken, Date Modified, Date Accessed, Date Aquired and Date Last Saved and for .jpgs most of these do have values. I am sure PowerShell has access to these dates as well. I will however give EXIFTool a try and see if it is any more helpful than DropIt was. I am hoping it can automate what I am trying to do. I have already sorted by Camera > Make > Model but for example, I have one folder for one camera make and model of photos that has over 87,000 photos in it and the dates are all over the place. In some cases, Date Modified is very helpful, other cases Date Accessed, etc. But I did quickly realize that the oldest date in these columns is, in 90% of all cases, the date I should sort by. This could be Date Modified in some cases. In other cases Date Taken is better. Sometimes Date Accessed is better. And doing a web search, you will find that sometimes with photo dates, Date Taken date can be newer than Date Modified, etc. It’s strange but it is something photographers have to deal with.

How are you sure about this? Explorer.exe has many capabilities that powershell does not. You may be able to use a com object to read the metadata, but that is not powershell specific.

I had rewritten Ed’s Get-FileMetaData previously. You can give it a try if you like.


Thanks for posting this. I might be able to save all the metadata in Excel and then write a VBA macro to find the lowest date and then I could use VBA to aoutmate this. I’m far better at VB than I am at PowerShell.