This is an old revision of the document!


Zotero数据目录

定位您的Zotero数据目录

您可以在Zotero首选项窗口中的高级中点击“打开数据文件夹”按钮找到您的Zotero数据目录

数据目录默认位置

Zotero 5.0

您可以在高级设置面板中自定义您的数据目录。默认的数据目录如下:

macOS
/Users/<username>/Zotero
Windows 7 及更高
C:\Users\<User Name>\Zotero
Windows XP/2000
C:\Documents and Settings\<username>\Zotero
Linux
~/Zotero

Zotero 4.0 for Firefox

OS X
/Users/<username>/Library/Application Support/Firefox/Profiles/<randomstring>/zotero
Windows 7 及更高
C:\Users\<User Name>\AppData\Roaming\Mozilla\Firefox\Profiles\<randomstring>\zotero
Windows XP/2000
C:\Documents and Settings\<username>\Application Data\Mozilla\Firefox\Profiles\<randomstring>\zotero
Linux (大多数发行版)
~/.mozilla/firefox/Profiles/<randomstring>/zotero

Zotero 4.0 Standalone

OS X
/Users/<username>/Library/Application Support/Zotero/Profiles/<randomstring>/zotero
Windows 7 及更高
C:\Users\<User Name>\AppData\Roaming\Zotero\Zotero\Profiles\<randomstring>\zotero
Windows XP/2000
C:\Documents and Settings\<username>\Application Data\Zotero\Profiles\<randomstring>\zotero
Linux (大多数发行版)
~/.zotero/Profiles/<randomstring>/zotero

“打开数据目录”按钮将始终显示当前正在使用的数据目录,并且这也是查找数据目录的推荐方法。如果你无法访问Zotero的首选项设置,您也可以通过搜索'zotero.sqlite'文件来查找您的Zotero数据目录。

Library Contents

The most important file in the 'zotero' directory is the zotero.sqlite file, which contains the majority of your data: item metadata, notes, tags, etc. The directory also contains a 'storage' subdirectory, containing all of your file attachments, such as PDFs, web snapshots, audio files, or any other files you have imported (note that files that are linked are not copied into this subdirectory).

Your 'zotero' directory will likely contain several other files. These can include zotero.sqlite.bak (an automatic backup of zotero.sqlite, which is updated when you quit Zotero and the existing zotero.sqlite.bak file hasn't been updated in the last 12 hours) and zotero.sqlite.[number].bak files (automatic backups of zotero.sqlite that are created during certain Zotero updates).

Warning: Before you copy, delete, or move any of these files, be sure that Zotero is closed. Failure to do so before moving these files can damage your data.

Backing Up Your Zotero Library

We strongly recommend that you regularly back up your Zotero library. Syncing is not a good substitute for backing up: the Zotero server only stores the most recent version of your library, and it takes just a single (possibly automatic) sync to change the server copy.

Rather than backing up just your Zotero library, we recommend using a backup utility that automatically backs up your entire hard drive to an external device on a regular basis. Most modern operating systems offer such functionality (e.g., Time Machine on Macs).

If you want to back up your Zotero library specifically, locate your Zotero library, close Zotero , and copy your zotero data directory to a backup location (copy the entire directory, including storage and the other subdirectories), preferably on another storage device. As with all important data, it is a good idea to back up your Zotero data frequently.

Warning: Zotero lets you export your Zotero library as a Zotero RDF file. However, exporting and importing your library via RDF won't result in an exact copy of your library, and it isn't recommended as a backup strategy.

For step-by-step, illustrated backup instructions, see this guide provided by the Northwestern University library.

Restoring Your Zotero Library from a Backup

Between manual backups, automatic backups, and synced data, it's often possible to restore a lost Zotero library or restore data that was accidentally deleted.

Before following these steps, be sure that Zotero is looking in the right place for your data.

Restoring your Zotero library using Zotero syncing

If you were using Zotero syncing and have an empty local library, you can likely restore your library simply by syncing with the Zotero server. After verifying that your library exists on zotero.org, simply reenter your username and password into the Sync pane of Zotero preferences and click the Sync button in the toolbar. (Zotero only syncs explicit deletions, so just syncing an empty library won't overwrite the server data unless you deleted items manually.)

If you have a local Zotero library that you want to overwrite, close Zotero and delete the old Zotero data directory before syncing. Syncing your local library to a different Zotero account will also overwrite the local library.

Restoring your Zotero library from a backup

If you were not using Zotero syncing (or were but don't want to perform a full sync) and have a backup of your Zotero data directory, you can restore your library by replacing the contents of your active data directory with that of your backed-up data directory.

Open the Advanced pane of the Zotero preferences and click “Show Data Directory”. This should reveal your active data directory containing zotero.sqlite and possibly a 'storage' subdirectory. Close Zotero and move zotero.sqlite and 'storage' from this folder into a temporary folder on your desktop. Next, copy zotero.sqlite and 'storage' from your backup into the active data directory. When you now reopen Zotero, your Zotero library should be restored.

Once you've successfully restored your data, you can delete the temporary folder on your desktop.

Note that, if you were using Zotero syncing, any changes you made to your library since the backup and subsequently synced to the Zotero server will be applied to your restored database as soon as you sync.

Restoring your Zotero library from a backup and overwriting synced changes

If you or someone else made unwanted changes to your Zotero library and synced those changes to the server, you may be able to restore data by using a local backup of your Zotero data directory.

First, disable auto-sync in the Sync pane of the Zotero preferences. Open the Advanced pane of the preferences and click “Show Data Directory”. This should reveal your active data directory containing zotero.sqlite and possibly a 'storage' subdirectory. Close Zotero and move zotero.sqlite and 'storage' from this folder into a temporary folder on your desktop. Next, copy zotero.sqlite and 'storage' from your backup into the active data directory. When you now reopen Zotero, your Zotero library should be restored.

Were you to sync again now, the more recent server data would replace the data you just restored. Instead, you can duplicate the affected items by right-clicking on them and choosing “Duplicate Item(s)”. When you then sync, the more recent changes from the server will still be applied to your local database, but the duplicate items will not be affected and will sync up to the server.

Alternatively, if many items were affected or collections were deleted, you can force the Zotero server to keep your local copies of the items/collections. The steps to do so are currently somewhat involved. Please make a post on the Zotero forums describing your exact situation, and the Zotero developers or community members will walk you through the steps.

Once you've successfully restored your data, you can re-enable auto-sync and delete the temporary folder on your desktop.

Restoring from the last automatic backup

If you make a critical mistake while using Zotero — for example, if you accidentally delete a large set of items — you may be able to revert to the last automatic backup.

If you're using syncing but don't have auto-sync enabled, first check your online library on zotero.org to see if the data is correct there. If so, close Zotero, go to your Zotero data directory, and rename it (e.g., to “Zotero-old”). Then, re-open Zotero and sync from the Zotero servers to the new empty local library.

If you don't want to do a full sync or if the changes have already synced to the Zotero server, follow these steps:

  1. First, make sure to keep Zotero running, as the automatic backup might be overwritten when you quit the application.
  2. If you're using syncing, temporarily disable auto-sync in the Sync pane of the Zotero preferences.
  3. Locate your Zotero library and make a copy of any zotero.sqlite.bak files. The timestamps of the files may help you determine which file would contain the data you're trying to restore.
  4. Close Zotero. In your data directory, rename zotero.sqlite to zotero.sqlite.old, rename one of the .bak copies you made to zotero.sqlite, and restart Zotero. You should now see the backed-up version of your library.
  5. Were you to sync again now, the more recent server data would replace the data you just restored. If you're trying to restore a small number of deleted items or notes, you can simply duplicate the items — by right-clicking and choosing “Duplicate Item(s)” — so that the new copies remain even after syncing.
  6. If many items were affected or collections were deleted, you can force the Zotero server to keep your local copies of the items/collections. The steps to do so are currently somewhat involved. Please make a post on the Zotero forums describing your exact situation, and the Zotero developers or community members will walk you through the steps.
  7. After making changes to the local database, you can sync, which should download any data modified since the backup and upload your local changes (and possibly ask you to resolve any conflicts, which you can do by choosing the local items).

If you're happy with the results, you can delete zotero.sqlite.old.

Restoring from the last upgrade backup

Zotero prompts you to upgrade your database when you install certain (usually major) new versions. If you would like to revert to a previous version of Zotero at a later point, you will have to manually replace your database with the automatic backup Zotero made during the upgrade. In most cases this will be the highest-numbered “zotero.sqlite.[num].bak” file in your Zotero data directory.

It's a good idea to make a backup of your entire Zotero data directory before making any changes.

If you have synced your data with the Zotero server, reverting to a previous version is as simple as reinstalling the previous version, closing Zotero, replacing “zotero.sqlite” in your Zotero data directory with “zotero.sqlite.[highest-number].bak”, and restarting Zotero. (Note that if you try to open an upgraded database in an earlier version, Zotero will display an error. Just close Zotero and replace the SQLite file.) Zotero will then sync from the Zotero server any changes made since you last used the older database.

If you were not using syncing, you may wish to export to Zotero RDF any items added since the database upgrade and then reimport those into the earlier version. Sorting your library by Date Added may help you find such items.

Bear in mind that word processor documents used with later Zotero versions often cannot be used again with earlier versions, and Zotero developers and community members will provide only limited support for earlier versions (mostly to recommend upgrading to the current version).

Troubleshooting Zotero Data issues

Where did my items go?

In rare cases after upgrades or system restores, users open Zotero to find their libraries almost completely blank. If this happens to you, do not panic. In almost every case, Zotero is simply looking in the wrong location for the data. You need to make sure that Zotero is looking in the right location for your Zotero files and that the right files are in that spot.

Make sure your data files are in the directory where Zotero is looking.

Use the “Show Data Directory” button in the Advanced pane of your Zotero preferences to reveal the current data directory. If this isn't the directory you were expecting, you can either specify a different data directory from the preferences or, with Zotero closed, move any existing Zotero files (zotero.sqlite and 'storage') out of the way and copy your desired Zotero files into the displayed directory. If you're not sure where your data is located, it's a good idea to look for larger versions of zotero.sqlite or zotero.sqlite.bak stored elsewhere on your hard drive and to look in the 'storage' directory for recently saved PDFs and other files.

If you have recently updated to Zotero 5 and are missing data, see Missing Data After Zotero 5 Upgrade.

Unless you have a good reason to use a custom data directory location, we recommend using the default location in your home directory.

When specifying a custom data directory location, keep in mind that Zotero doesn't move or copy any data. You still need to copy your data into the specified location. Also, when pointing the data directory location to an existing directory, be sure to specify the parent directory containing zotero.sqlite and 'storage', not the 'storage' directory itself.

Finally, remember to close Zotero before making any changes to Zotero files.