« PowerShell/Vidéo » : différence entre les versions

Aller à la navigation Aller à la recherche
(Page créée avec « {{Sommaire}} Pour les traitements vidéos. == Déplacement de fichier vidéo == <source> clear-host set-location "D:\_Brut\" $dateheure = Get-Date -UFormat "%Y%m%d-%H%M%S" #$filmListe = Get-ChildItem -filter "*.mkv" $filmListe1280 = Get-ChildItem -filter "*.mkv" | ? { $_.Name -match '(?:1280.*q23)' -and ($_.length -gt 50) } #$filmListe1920 = Get-ChildItem -filter "*.mkv" | ? { $_.Name -match '(?:1920.*q23)' -and ($_.length -gt 50) } write-host "Date courante... »)
 
Ligne 3 : Ligne 3 :
Pour les traitements vidéos.
Pour les traitements vidéos.


== Déplacement de fichier vidéo ==
== Déplacement de fichier vidéo, version 1 ==
 
<source>
<source>
clear-host
Clear-Host
set-location "D:\_Brut\"
Set-Location "D:\_Brut\"
$dateheure = Get-Date -UFormat "%Y%m%d-%H%M%S"
$dateheure = Get-Date -UFormat "%Y%m%d-%H%M%S"


$filmListe1280 = Get-ChildItem -Filter "*.mkv" | ? { $_.Name -match '(?:1280.*q23)' -and ($_.length -gt 50) }
#$filmListe1920 = Get-ChildItem -Filter "*.mkv" | ? { $_.Name -match '(?:1920.*q23)' -and ($_.length -gt 50) }


#$filmListe = Get-ChildItem -filter "*.mkv"
Write-Host "Date courante : $dateheure"
Foreach ($film in $filmListe1280) {
    Write-Host ("* {0} : {1:N2} Go" -f $film, ($film.Length/1GB))
    Move-Item $film -Destination "E:\video-1280\"
}
Write-Host
Write-Host ("Nombre d'éléments : {0}" -f $filmListe1280.Count)
</source>


$filmListe1280 = Get-ChildItem -filter "*.mkv" | ? { $_.Name -match '(?:1280.*q23)' -and ($_.length -gt 50) }
== Déplacement de fichier vidéo, version 2 ==
<source>
Clear-Host
Set-Location "D:\_Brut\"
$dateheure = Get-Date -UFormat "%Y%m%d-%H%M%S"


#$filmListe1920 = Get-ChildItem -filter "*.mkv" | ? { $_.Name -match '(?:1920.*q23)' -and ($_.length -gt 50) }
$filmListe1280 = Get-ChildItem -Filter "*.mp4" | ? { $_.Name -Match '(?:1280.*q23)' -And ($_.length -gt 50) } | Sort-Object -Property Length
$filmListe1920 = Get-ChildItem -Filter "*.mp4" | ? { $_.Name -Match '(?:1920.*q23)' -And ($_.length -gt 50) } | Sort-Object -Property Length


write-host "Date courante : $dateheure"
Write-Host "Date courante : $dateheure"
foreach ($film in $filmListe1280) {  
Foreach ($film in $filmListe1280) {  
     write-host ("* {0} : {1:N2} Go" -f $film, ($film.Length/1GB))
     Write-Host ("* {0} : {1:N2} Go" -f $film, ($film.Length/1GB))
     move-item $film -Destination "E:\video-1280\"
     Move-Item $film -Destination "E:\video-1280\"
}
}
write-host
Foreach ($film in $filmListe1920) {
write-host ("Nombre d'éléments : {0}" -f $filmListe1280.Count)
    Write-Host ("* {0} : {1:N2} Go" -f $film, ($film.Length/1GB))
    Move-Item $film -Destination "E:\video-hd\"
}
 
Write-Host
Write-Host ("Nombre d'éléments 1280 : {0}" -f $filmListe1280.Count)
Write-Host ("Nombre d'éléments 1920 : {0}" -f $filmListe1920.Count)
</source>
</source>



Version du 19 octobre 2023 à 20:53

Pour les traitements vidéos.

Déplacement de fichier vidéo, version 1

Clear-Host
Set-Location "D:\_Brut\"
$dateheure = Get-Date -UFormat "%Y%m%d-%H%M%S"

$filmListe1280 = Get-ChildItem -Filter "*.mkv" | ? { $_.Name -match '(?:1280.*q23)' -and ($_.length -gt 50) }
#$filmListe1920 = Get-ChildItem -Filter "*.mkv" | ? { $_.Name -match '(?:1920.*q23)' -and ($_.length -gt 50) }

Write-Host "Date courante : $dateheure"
Foreach ($film in $filmListe1280) { 
    Write-Host ("* {0} : {1:N2} Go" -f $film, ($film.Length/1GB))
    Move-Item $film -Destination "E:\video-1280\"
}
Write-Host
Write-Host ("Nombre d'éléments : {0}" -f $filmListe1280.Count)

Déplacement de fichier vidéo, version 2

Clear-Host
Set-Location "D:\_Brut\"
$dateheure = Get-Date -UFormat "%Y%m%d-%H%M%S"

$filmListe1280 = Get-ChildItem -Filter "*.mp4" | ? { $_.Name -Match '(?:1280.*q23)' -And ($_.length -gt 50) } | Sort-Object -Property Length
$filmListe1920 = Get-ChildItem -Filter "*.mp4" | ? { $_.Name -Match '(?:1920.*q23)' -And ($_.length -gt 50) } | Sort-Object -Property Length

Write-Host "Date courante : $dateheure"
Foreach ($film in $filmListe1280) { 
    Write-Host ("* {0} : {1:N2} Go" -f $film, ($film.Length/1GB))
    Move-Item $film -Destination "E:\video-1280\"
}
Foreach ($film in $filmListe1920) { 
    Write-Host ("* {0} : {1:N2} Go" -f $film, ($film.Length/1GB))
    Move-Item $film -Destination "E:\video-hd\"
}

Write-Host
Write-Host ("Nombre d'éléments 1280 : {0}" -f $filmListe1280.Count)
Write-Host ("Nombre d'éléments 1920 : {0}" -f $filmListe1920.Count)

Voir aussi

  •