Last active
October 4, 2017 02:29
-
-
Save rsc-awhite/640b7122c6619c851c101c4348e89313 to your computer and use it in GitHub Desktop.
This file contains 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
require 'csv' | |
import_file = "./keepass-export.csv" | |
export_file = "./passwordstate-import.csv" | |
headers = "Title,UserName,Description,Notes,URL,Password,ExpiryDate,WebUser_ID,WebPassword_ID,\n" | |
keepass_headers = ['Group', 'Title', 'Username', 'Password', 'URL', 'Notes'] | |
rows = headers | |
CSV.foreach(import_file, headers: true) do |row| | |
this_row = [ row[1], row[2], '', row[5], row[4], row[3], '', '', ''].to_csv | |
rows << this_row | |
end | |
File.open(export_file, 'w') { |file| file.write(rows) } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment