diff --git a/src/main/resources/pp.bat b/src/main/resources/pp.bat new file mode 100644 index 00000000..74d6c000 --- /dev/null +++ b/src/main/resources/pp.bat @@ -0,0 +1,17 @@ +REM This script is just a wrapper to call the actual powershell script. +REM But you do something complete different here, too. +REM +REM If you want to use powershell, make sure, that your system allows the execution of powershell scripts: +REM 1. Open cmd.exe as administrator (Click on start, type cmd.exe, right-click on it and select "Run as administrator") +REM 2. Execute powershell +REM 3. Execute Set-ExecutionPolicy Unrestricted + +@echo off + +set directory=%1 +set file=%2 +set model=%3 +set site=%4 +set unixtime=%5 + +powershell -F C:\Users\henrik\Desktop\ctbrec\pp.ps1 -dir "%directory%" -file "%file%" -model "%model%" -site "%site%" -time "%unixtime%" \ No newline at end of file diff --git a/src/main/resources/pp.ps1 b/src/main/resources/pp.ps1 new file mode 100644 index 00000000..47550440 --- /dev/null +++ b/src/main/resources/pp.ps1 @@ -0,0 +1,17 @@ +# parse command line parameters +param ( + [Parameter(Mandatory=$true)][string]$dir, + [Parameter(Mandatory=$true)][string]$file, + [Parameter(Mandatory=$true)][string]$model, + [Parameter(Mandatory=$true)][string]$site, + [Parameter(Mandatory=$true)][string]$time +) + +# convert unixtime into a date object +$epoch = get-date "1/1/1970" +$date = $epoch.AddSeconds($time) + +# print out a theoretical new file name, you could use "rename" here, to rename the file +# or move it somewhere or ... +$newname = "$($model)_$($site)_$($date.toString("yyyyMMdd-HHmm")).ts" +ren $file $newname \ No newline at end of file diff --git a/src/main/resources/pp_example.sh b/src/main/resources/pp.sh similarity index 100% rename from src/main/resources/pp_example.sh rename to src/main/resources/pp.sh