This is an old revision of the document!
Déplacer les fichiers par date vers un autre dossier
$Destination = 'F:\Photos\' $Source = 'F:\Photos\2019' Get-ChildItem -Path $Source -File -Filter *.jpg -Recurse| ForEach-Object { $Year = $_.lastwritetime.year.ToString("0000") $Month = $_.lastwritetime.month.ToString("00") $Day = $_.lastwritetime.day.ToString("00") $D = Join-Path $Destination -ChildPath "$Year\$Month-$Year\$Day-$Month-$Year" if ((Test-Path $D) -eq $false){New-Item -Path $D -ItemType Directory -Force | Out-Null} Move-Item -Path $_.FullName -Destination (Join-Path -Path $D -ChildPath $_.name ) -Force }