python - Ubuntu 一个文件夹同步过滤器

标签 python ubuntu ubuntu-10.04 cloud-platform

我正在尝试修改 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/

相关文章:

python - 使用 python 从 pdf 中读取表格

python - 在 Python 中反转列表的顺序

mysql - 问题 无法登录MySQL服务器

regex - sed 错误 "Invalid range end"

linux - Prof. 在 Linux 中布局安装文件的方法是什么

python - Twitter HTTP 请求 : 403 error

python - Django allauth 不会在电子邮件确认时登录用户

php - NGINX - 安装了 CURL 扩展,但系统说它丢失了

c - Ubuntu 中的 wait() 函数

python - pip 不工作