Skip to content

Instantly share code, notes, and snippets.

@igrep
Last active January 7, 2019 23:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save igrep/843098ca14cf6fb918a7c9d4ce95a594 to your computer and use it in GitHub Desktop.
Save igrep/843098ca14cf6fb918a7c9d4ce95a594 to your computer and use it in GitHub Desktop.
Export notes in evernote by date
Set-PSDebug -trace 2
$FORMAT = "yyyy-MM-dd"
$QUERY_FORMAT = "yyyyMMdd"
$since = [DateTime]::ParseExact($args[0], $FORMAT, $null)
$until = if ($args[1]) {
[DateTime]::ParseExact($args[1], $FORMAT, $null)
} else {
Get-Date
}
$diff = $until - $since
0..($diff.Days - 1) | ForEach-Object {
$day1 = $since.AddDays($_)
$day2 = $day1.AddDays(1)
$outDayStr = $day1.toString("$FORMAT")
$outName = "enexs/$outDayStr.enex"
$enscript = "C:\Program Files (x86)\Evernote\Evernote\ENScript.exe"
$day1Str = $day1.toString($QUERY_FORMAT)
$day2Str = $day2.toString($QUERY_FORMAT)
Start-Process -FilePath $enscript -ArgumentList "exportNotes", "/f", "$outName", "/q", "`"created:$day1Str -created:$day2Str`"" -Wait -NoNewWindow
}
Set-PSDebug -trace 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment