我正在尝试修改 Ubuntu One File 同步 python 脚本,使其不包括诸如 .iso 之类的内容。
我已经找到了这个文件:/usr/share/pyshared/ubuntuone/u1sync/constants.py
里面是这段代码:
import re
# the name of the directory u1sync uses to keep metadata about a mirror
METADATA_DIR_NAME = u".ubuntuone-sync"
# filenames to ignore
SPECIAL_FILE_RE = re.compile(".*\\.("
"(u1)?partial|part|"
"(u1)?conflict(\\.[0-9]+)?)$")
我如何编辑这最后一部分(正则表达式?)并使其忽略 .iso 文件???我相当确定这是放置它的地方!
很确定这是标准的 python 操作 :)
如有任何帮助,我们将不胜感激。
谢谢。
安迪
最佳答案
regex documentation for python将是查找它的地方。
对于 isos,您可能只需在最后一行添加 "|.*\.iso$"
。
关于python - Ubuntu 一个文件夹同步过滤器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3005602/