[Python-ideas] find-like functionality in pathlib

Ram Rachum ram at rachum.com
Fri Dec 4 14:08:23 EST 2015


1. That would require going out of the pathlib framework. I  can do that
but it's more of a mess because then I need to convert the results back to
Path objects.
2. Not sure how I would use fnmatch, because I wouldn't want to give it the
list of all files recursively, since that would be a long list of files
(lots of files in ".git" folder that I want to ignore.) I want it to first
ignore everything in the ".git" folder completely without going over all
the files, and then include all the other files recursively.

On Fri, Dec 4, 2015 at 9:04 PM, Laura Creighton <lac at openend.se> wrote:

> In a message of Fri, 04 Dec 2015 21:00:47 +0200, Ram Rachum writes:
> >What do you think about implementing functionality similar to the `find`
> >utility in Linux in the Pathlib module? I wanted this today, I had a
> script
> >to write to archive a bunch of files from a folder, and I decided to try
> >writing it in Python rather than in Bash. But I needed something stronger
> >than `Path.glob` in order to select the files. I wanted a regular
> >expression. (In this particular case, I wanted to get a list of all the
> >files excluding the `.git` folder and all files inside of it.
>
> fnmatch https://docs.python.org/3.6/library/fnmatch.html
> wasn't sufficient for your needs?
>
> Laura
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20151204/fa992d5f/attachment.html>


More information about the Python-ideas mailing list