Created
November 7, 2015 22:42
-
-
Save ghotz/9ccba3178d56bbc05a4a to your computer and use it in GitHub Desktop.
Converts Polar Flow TCX file for Garmin Connect
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Removes incorrect data from *.tcx files exported from the Polar Flow | |
# web site so they can be uploaded to the Garmin web site. | |
# More info: https://forums.garmin.com/showthread.php?165708-Polar-Flow-TCX-export-to-Garmin-Connect | |
# | |
$SourceDir = "C:\Users\Gianluca\OneDrive\Documents\Health\PolarFlow"; | |
$DestinationDir = "C:\Users\Gianluca\OneDrive\Documents\Health\ExportGarmin"; | |
Get-ChildItem $SourceDir -Include "*.tcx" -Recurse | | |
Where-Object { !(Test-Path (Join-Path $DestinationDir $_.Name)) } | | |
ForEach-Object { | |
Write-Host "Processing $($_.Name)"; | |
[xml]$tcx = Get-Content $_.FullName; | |
$node = $tcx.TrainingCenterDatabase.Author; | |
if ($node -ne $null) { $node.ParentNode.RemoveChild($node) | Out-Null; }; | |
$node = $tcx.TrainingCenterDatabase.Activities.Activity.Creator; | |
if ($node -ne $null) { $node.ParentNode.RemoveChild($node) | Out-Null; }; | |
$tcx.Save((Join-Path $DestinationDir $_.Name)); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I tried this just now, and Garmin Connect didn't accept the file. Any idea why?