duplicity-talk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Duplicity-talk] Single vs double asterisk


From: Aaron Whitehouse
Subject: [Duplicity-talk] Single vs double asterisk
Date: Fri, 13 Mar 2015 15:53:30 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0

Hello all,

I've been having a play around with single and double asterisks, to see what the current behaviour is.

The manual says:
'As in a normal shell, * can be expanded to any string of characters not containing "/", ? expands to any character except "/", and [...] expands to a single character of those characters specified (ranges are acceptable). The new special pattern, **, expands to any string of characters whether or not it contains "/".'

I understood this to mean that "parent/*" should include files within the folder "parent", but not any subdirectories, whereas "parent/**" would include files in "parent" but also include subfolders. Is that how other people understand it?

My preliminary tests suggest it isn't working like that and a single * seems to also include subfolders.

The test:

    def test_single_and_double_asterisks(self):
        """This compares a backup using --include-globbing-filelist with a single and double *."""
        with open("testfiles/filelist.txt", 'w') as f:
            f.write("+ testfiles/select2/*\n"
                    "- testfiles/select")
        self.backup("full", "testfiles/", options=["--include-globbing-filelist=testfiles/filelist.txt"])
        self.restore()
        restore_dir = 'testfiles/restore_out'
        restored = self.directory_tree_to_list_of_lists(restore_dir + "/select2")
        with open("testfiles/filelist2.txt", 'w') as f:
            f.write("+ testfiles/select2/**\n"
                    "- testfiles/select")
        self.backup("full", "testfiles/", options=["--include-globbing-filelist=testfiles/filelist2.txt"])
        self.restore()
        restore_dir = 'testfiles/restore_out'
        restored2 = self.directory_tree_to_list_of_lists(restore_dir + "/select2")
        self.assertEqual(restored, restored2)
        print(restored)

currently passes (suggesting, at least in this set-up, * is equivalent to **) and "select2/*" is including all subfolders of select2. I get the same result using the (non-filelist) --include=testfiles/select2/* or --include=testfiles/select2/** options.

I would really appreciate it if people who use either * or ** in their filelists or in --include/-excludes could have a quick try with the other and see if it makes any difference. Any other thoughts would of course be appreciated.

Kind regards,

Aaron 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]