added Slippi Sorter
This commit is contained in:
parent
d21b7940f7
commit
a607faae88
|
|
@ -0,0 +1,43 @@
|
|||
#!/usr/bin/pwsh
|
||||
|
||||
#
|
||||
# author: arian furrer
|
||||
# date: 2024-06-01
|
||||
#
|
||||
|
||||
#
|
||||
# This script copies Slippi replays into sub-folders in case you
|
||||
# forgot to set the flag that already does that. Mainly used
|
||||
# for older replays
|
||||
#
|
||||
|
||||
#
|
||||
# Usage:
|
||||
# ./group-replays-by-date.ps1 -InputDir /path/to/in -OutputDir /path/to/out
|
||||
#
|
||||
|
||||
param(
|
||||
[Parameter(Mandatory)]
|
||||
[String]$InputDir,
|
||||
|
||||
[Parameter(Mandatory)]
|
||||
[String]$OutputDir
|
||||
)
|
||||
|
||||
$AllFiles = $( Get-ChildItem -Path $InputDir -Filter 'Game_*.slp' -Depth 1 )
|
||||
|
||||
ForEach ($f in $AllFiles) {
|
||||
$FileName = $f.Name
|
||||
$FilePath = $f.FullName
|
||||
|
||||
$DateString = $( ( $FileName.Split("_").Split("T") )[1] )
|
||||
$NewDateString = $( [datetime]::ParseExact($DateString,"yyyyMMdd",$null) ).ToString('yyyy-MM')
|
||||
|
||||
$NewOutputDir = $( Join-Path $OutputDir $NewDateString )
|
||||
|
||||
if ( -not ( Test-Path $NewOutputDir ) ) {
|
||||
New-Item -Path $NewOutputDir -ItemType Directory
|
||||
}
|
||||
|
||||
Copy-Item -Path $FilePath -Destination $( Join-Path $NewOutputDir $FileName ) -Verbose
|
||||
}
|
||||
Loading…
Reference in New Issue