Difference between revisions of "File"

From GnuCash
Jump to: navigation, search
(How can I edit the file?: make preference more clear)
(Improving readability)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
The data file of [[GnuCash]] has two issues that are being asked again and again:
+
Two questions regarding GnuCash data files arise again and again:
  
=== Where is the gnucash file? ===
+
'''1. Where is the GnuCash file?'''
The file name is what you first enter as file name. Just this. No prefix, no suffix, just the name. If you enter "<tt>/home/myself/foobar</tt>" in the "Save as..." dialog window, the file will be written into "<tt>/home/myself/foobar</tt>" and nothing else. See also [[FAQ#Q:_Where_is_my_.XML_data_file?]]
+
::As with any application that allows users to create information and save it, GnuCash saves your data in a file that uses the name and folder that ''you choose'' in the ''Save as...'' dialog.  To this file name is usually added the ".gnucash" file extension. So, if you enter "<tt>/home/myself/foobar</tt>" in the "Save as..." dialog window, the file will be written as "<tt>/home/myself/foobar.gnucash</tt>".  
* However, in addition to the original "<tt>foobar</tt>" file, GnuCash will also save backup files and log files. The additional backup files will be saved as "<tt>foobar.<TIMESTAMP>.xac</tt>", the log files will be saved as "<tt>foobar.<TIMESTAMP>.log</tt>". Those files can be deleted regularly if you don't need any further backup. See also [[FAQ#Q:_What_are_all_these_.xac_and_.log_files_filling_up_my_directory?]]
+
::Note that, in addition to the original "<tt>foobar.gnucash</tt>" file, GnuCash will also save backup files and log files. See [[FAQ#Q:_What_are_all_these_.gnucash_and_.log_files_filling_up_my_directory?|What are all these .gnucash and .log files filling up my directory]] for more information.
 
+
::Before GnuCash 2.4, the default file name extension was .xac and it was optional. If you didn't specify it in your file name the GnuCash file would simply have not extension. The backup files would still have .xac as extension.
=== How can I edit the file? ===
+
'''2. How can I edit the XML file?'''
The file itself is XML data but in compressed form (compressed by the program <tt>gzip</tt>).  
+
::The default file format is XML, but it is stored by default in compressed form (i.e., compressed by the program <tt>gzip</tt>).  
 
+
::This is switched on or off according to the preference setting in '''Edit->Preferences->General''' where you can set or unset the checkmark at '''File compression'''. By default it is activated.
* This is switched on or off according to the preference setting in '''Edit->Preferences->General''' where you can set or unset the checkmark at '''File compression'''. By default it is activated.
+
::In order to view your data in a text editor, you need to expand the compressed XML data, either by changing the preference or by uncompressing the data file using the tool available on your operating system.  
 
+
::'''It is strongly recommended that you have backups of your file before opening the source XML.'''
In order to have a look at your data by a text editor, you need to open a terminal window (console window) and enter the following commands:
+
::Once you have edited and saved the file, you don't have to <tt>gzip</tt> it yourself; GnuCash will do this upon the next save if set in preferences.
mv foobar foobar.gz
 
gunzip foobar.gz
 
where you need to replace "<tt>foobar</tt>" by your actual file name, of course. After these two commands have been entered, you can open the resulting file "<tt>foobar</tt>" in a text editor.  
 
 
 
If you intend to make some manual changes, make sure to have a backup of your original file somewhere in case you get something wrong.
 
 
 
Once you have edited and saved the file, you don't have to <tt>gzip</tt> it yourself; GnuCash will do this upon the next save.
 

Latest revision as of 13:07, 6 November 2018

Two questions regarding GnuCash data files arise again and again:

1. Where is the GnuCash file?

As with any application that allows users to create information and save it, GnuCash saves your data in a file that uses the name and folder that you choose in the Save as... dialog. To this file name is usually added the ".gnucash" file extension. So, if you enter "/home/myself/foobar" in the "Save as..." dialog window, the file will be written as "/home/myself/foobar.gnucash".
Note that, in addition to the original "foobar.gnucash" file, GnuCash will also save backup files and log files. See What are all these .gnucash and .log files filling up my directory for more information.
Before GnuCash 2.4, the default file name extension was .xac and it was optional. If you didn't specify it in your file name the GnuCash file would simply have not extension. The backup files would still have .xac as extension.

2. How can I edit the XML file?

The default file format is XML, but it is stored by default in compressed form (i.e., compressed by the program gzip).
This is switched on or off according to the preference setting in Edit->Preferences->General where you can set or unset the checkmark at File compression. By default it is activated.
In order to view your data in a text editor, you need to expand the compressed XML data, either by changing the preference or by uncompressing the data file using the tool available on your operating system.
It is strongly recommended that you have backups of your file before opening the source XML.
Once you have edited and saved the file, you don't have to gzip it yourself; GnuCash will do this upon the next save if set in preferences.