Hi All,
I’m trying to make sense of 1000’s of photos and I’m looking for something a little different to the year - month standard option. I’m trying to sort my pictures between specific dates for instance.
For example:
Pics from between 05-01-2000 & 04-02-2000 to be moved to directory Year 1\Month 0
Pics from between 05-02-2000 & 04-03-2000 to be moved to directory Year 1\Month 1
Pics from between 05-03-2000 & 04-04-2000 to be moved to directory Year 1\Month 2
Pics from between 05-04-2000 & 04-05-2000 to be moved to directory Year 1\Month 3
From searching i have found the following script
[CmdletBinding(SupportsShouldProcess=$true)]
param (
[Parameter(Mandatory=$true)][string]$SourceDirectory,
[Parameter(Mandatory=$true)][string]$DestinationDirectory,
[Parameter(Mandatory=$true)][string]$ModifiedAfter,
[Parameter(Mandatory=$true)][string]$ModifiedBefore
)
Get-ChildItem -Path $SourceDirectory |
Where-Object {
$_.LastWriteTime `
-gt (Get-Date $ModifiedAfter) `
-and $_.LastWriteTime -lt (Get-Date $ModifiedBefore) } |
ForEach-Object { $_ | Copy-Item -Destination $DestinationDirectory }
You run it by
.\Copy-Files-Modified-Between-Dates `
-SourceDirectory C:\Temp\all `
-DestinationDirectory C:\Temp\subset `
-ModifiedAfter '2020-11-01 18:00' `
-ModifiedBefore '2020-11-02'
My question is can this be made to increment onto the next month automatically or to reference a file for info maybe a csv or text file to say
Pics from between 05-04-2010 & 04-05-2010 to be moved to directory Year 10\Month 3
If you guys have any better recommendations that would be great to see.
thanks