User Tools

Site Tools


script:powershell:multimedia:photo

This is an old revision of the document!


PowerShell et la photo

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
}

script/powershell/multimedia/photo.1604835367.txt.gz · Last modified: 2020/11/08 12:36 by admin