• You could use powershell and do this in a couple of lines with relative ease

    This is the "guts" of one of the scripts I'm using. (EDIT: There may be some missing parameters as this isnt the full script)

    $Instance =;

    $targetfolder=; ##Source of logfiles

    $result = invoke-sqlcmd -ServerInstance $Instance -Database "MSDB" -Query "select top 1 B.backup_finish_date from msdb.dbo.backupset B join msdb.dbo.restorehistory RH on RH.backup_set_id = B.backup_set_id where b.type = 'L' and rh.destination_database_name = '$Database' order by B.backup_set_id desc"

    $RestoreFrom = ($result.backup_finish_date).AddMinutes(1).Datetime <#Restore files after previous#>

    Get-ChildItem -path $TargetFolder -filter *.trn -recurse | Where-Object {$_.LastWriteTime -ge $lastbackuptime -and !$_.PsIsContainer} | Sort-Object lastwritetime | ForEach-Object {

    $sqlquery = "RESTORE LOG [$Database] from DISK = N'" + $_.fullname + "' WITH FILE = 1, NOUNLOAD, STATS = 10, NORECOVERY";

    #Write-Output $sqlquery

    invoke-sqlcmd -ServerInstance $Instance -Database "MSDB" -Query $sqlquery -QueryTimeout 900;

    }