[Python-ideas] find-like functionality in pathlib

Guido van Rossum guido at python.org
Tue Dec 22 15:14:47 EST 2015


The UNIX find tool has many, many options. For the general case it's
probably easier to use os.walk(). But there are probably some common uses
that deserve better direct support in e.g. the glob module. Would just a
way to recursively search for matches using e.g. "**.txt" be sufficient? If
not, can you specify what else you'd like? (Just " find-like" is too vague.)

--Guido (mobile)
On Dec 22, 2015 11:14 AM, "Thomas Güttler" <guettliml at thomas-guettler.de>
wrote:

> Am 04.12.2015 um 20:00 schrieb Ram Rachum:
> > 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.
>
>
> Me, too. I miss a find like method. I use os.walk() since more than 10
> years, but it still feels way too complicated.
>
> I asked about a library on softwarerecs some weeks ago:
>
>
> http://softwarerecs.stackexchange.com/questions/26296/python-library-for-traversing-directory-tree-like-unix-command-line-tool-find
>
>
>
>
> --
> http://www.thomas-guettler.de/
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20151222/931ac959/attachment.html>


More information about the Python-ideas mailing list