Search code examples
pythonubuntuubuntu-10.04cloud-platform

Ubuntu One Folder Sync Filter


I am trying to modify the Ubuntu One File syncing python scripts to not including things like .iso's.

I have got as far as finding this file: /usr/share/pyshared/ubuntuone/u1sync/constants.py

Inside is this piece of code:

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]+)?)$")

How can I edit this last section (regex?) and make it ignore .iso files??? I'm fairly sure this is the place to put it!

Pretty sure this is standard python action :)

Any help would be appreciated.

Thanks kindly.

Andy


Solution

  • UbuntuOne should really have a .ignore file or equally.... I want to ignore lots of stuff... .pyc, .blend1 just for start.

    UPDATE: it has - take a look at:

    https://answers.launchpad.net/ubuntuone-client/+question/114731

    OBSOLETE ANSWER:

    To answer... .*\\. is in the beginning of the old pattern, so replacing:

    "(u1)?conflict(\.[0-9]+)?)$")

    with:

    "(u1)?conflict(\.[0-9]+)?|iso)$")

    Should do it.

    Listing strings after each other in Python is just concatenating them so it's all one string.