首先,为知笔记是一款非常棒,非常良心的笔记软件,我从网文快捕时代就开始用。

替换的原因是他不开发新功能,而我需要双向链。

以下内容针对的是为知经典版,也就是4.1x这个版本,

wiz-version

为知笔记的开发者魏拾俊和李俊都是金山出来的,他们用金山的导入工具合情合理。

为知笔记是一款非常棒,非常良心的笔记软件,在菜单里提供了批量导出功能。

但是

文章里的附件不能导出。

用拷贝+改后缀名的方式就能把附件也导过来。

导出后的样子如下:

wiznote-1

1.设置

在设置里设置下载所有的个人笔记和附件数据,然后同步。

wiznote-2

如果默认设置的话

在C:\Users\(你的用户名)\Documents\My Knowledge\Data\为知账号
下有为知所有的数据

wiznote-3

进去看起来是这个样子的

wiznote-4

2.转移

为了不破坏原始数据,把需要的目录拷贝到其他地方
比如d:\111

运行程序,选择目录选择d:\111,他会把目录下所有的ziw改成zip,然后解压到相应的文件夹里,效果就是开头展示的。

这步是可以手工做的,程序只是自动化递归解压(子文件夹都遍历)而已。

xxxxx_Attachments就是附件,你要找附件就找同目录名同级的就行。

wiznote-5

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import os
import zipfile
import sys
import threading
import tkinter as tk
from tkinter import filedialog, messagebox


def process_dir(root, log):
count = 0
for dirpath, dirnames, filenames in os.walk(root):
for name in filenames:
if not name.lower().endswith(".ziw"):
continue
ziw = os.path.join(dirpath, name)
zip_path = os.path.splitext(ziw)[0] + ".zip"
target_dir = os.path.splitext(ziw)[0]
try:
os.rename(ziw, zip_path)
os.makedirs(target_dir, exist_ok=True)
with zipfile.ZipFile(zip_path) as zf:
zf.extractall(target_dir)
os.remove(zip_path)
count += 1
log("done: " + name)
except Exception as e:
log("error: " + name + " -> " + str(e))
return count


def main():
root = tk.Tk()
root.title("ziw -> zip")
root.geometry("560x320")

tk.Label(root, text="选择要处理的目录:").pack(pady=(12, 4))

dir_var = tk.StringVar()
dir_entry = tk.Entry(root, textvariable=dir_var, width=60)
dir_entry.pack(pady=4)

def choose():
d = filedialog.askdirectory(title="选择目录")
if d:
dir_var.set(d)

tk.Button(root, text="选择目录", command=choose).pack(pady=4)

log_text = tk.Text(root, height=12, width=64)
log_text.pack(padx=8, pady=6)

def do_process():
d = dir_var.get().strip()
if not d or not os.path.isdir(d):
messagebox.showwarning("提示", "请先选择有效的目录")
return
start_btn.config(state=tk.DISABLED)

def run():
try:
n = process_dir(d, lambda m: log_text.insert(tk.END, m + "\n") or log_text.see(tk.END))
log_text.insert(tk.END, "完成,共处理 " + str(n) + " 个文件\n")
except Exception as e:
log_text.insert(tk.END, "发生错误: " + str(e) + "\n")
finally:
root.after(0, lambda: start_btn.config(state=tk.NORMAL))

threading.Thread(target=run, daemon=True).start()

start_btn = tk.Button(root, text="开始处理", command=do_process)
start_btn.pack(pady=4)

root.mainloop()


if __name__ == "__main__":
main()