![]() Registered Member ![]()
|
After lots of research and testing, we have decided to transfer 17 years of Quicken data to kmymoney. The import went fairly well except that for each category there are dozens of duplicates with a value of $0.
I can delete these extras one at a time, but but it will take hours. kmymoney doesn't seem to let you multi-select categories, which is the next best option. What I would really like is an option to list all categories with a 0 sum with the option to remove them. But since none of those options seem to exist, does anyone have any ideas? Thanks in advance. |
![]() Registered Member ![]()
|
You can delete a parent category and all of its subcategories in one movement. Is it possible to isolate your duplicate categories somehow? E.g, move your "good" categories under a temporary new parent? Then remove the parent of the bad categories and restore the original hierarchy for the good categories.
If nothing works, you can try scripting them out of the kmy database using sed/awk/perl. |
![]() Registered Member ![]()
|
I decompressed the kmy file, and what I found was that accounts (categories) and subaccounts do not have summary amounts. So I wrote a quick Python program that creates a dictionary of all used subaccounts and creates a new file that excludes any subaccounts that are not used.
To use it:
Rename the extension to .gz Decompress ./pcats.py myfile newfile Compress the newfile using gzip Rename the newfile with a kmy extension Note that there will be output listing what subaccounts are active and inactive and deleted to stdout. So redirect stdout to a file if you want to save it and check it later.
|
![]() Registered Member ![]()
|
The previous code did not take into account transactions where the subaccounts were used in 0 splits. kmymoney would regenerate many of the subaccount categories for those transactions. This ugly code takes the additional step; I know, I could have used XPATH, but I was in a hurry to go to dinner. Note that this will remove voided transactions as well, since they sum to 0.
Once again, 1) rename your mykmy.mny file to mykmy.gz and decompress it. 2) Decompress it 3) run ./pcats mykmy newkmy 4) compress the new file to a gz file 5) rename to a kmy file
|
![]() Registered Member ![]()
|
That previous script was faulty. Here is the correct one and the procedure.
1) Make a copy of your kmy file (for example, finance.kmy) 2) Rename it to have a "gz" extension: finance.gz 3) Extract the file ('gunzip finance.gz"). You should now have a "finance" file. 4) Using your favorite text editor, paste the following script and save it to 'kmymoney-clean.py' 5) Make it executable, 'chmod +x kmymoney-clean.py' 6) Run it: './kmymoney-clean.py finance finance.new' 7) Compress finance.new: 'gzip finance.new' ![]() 9) Open it with kmymoney and verifiy that it looks Ok
|
Registered users: bartoloni, Bing [Bot], Google [Bot], q.ignora, watchstar