akaihola / hardlinkpy

hardlink.py is a tool to hardlink together identical files in order to save space. Forked from the original version by John L. Villalovos.
http://code.google.com/p/hardlinkpy/
GNU General Public License v2.0
20 stars 8 forks source link

Currently match is matched against the entire pathname, not just filename #18

Open chadnetzer opened 6 years ago

chadnetzer commented 6 years ago

This means, for example, if one wants to match against the files 'foo1' and 'foo99', it is required to use a match of "*foo*", rather than just "foo*". Ie. you have to match against an arbitrary initial pathname, just to match a part of a filename. The test suite unfortunately misses this case.

The match option is worded to imply matching filenames, as opposed to directories. A user that wants to match specific directory trees can simply supply just those directories as arguments. And they can exclude subdirectories with the -x option. So to me, it makes sense to change the match option to match filenames as implied.

The fnmatch module does allow matching against strings such as "foo/bar*", ie. it allows path separators. So if possible, we could also say that matching against a directory would require using the path separator in the match string.