george hu <geo...@gmail.com> added the comment:
Well, the listdir doesn't support "wildcard", for example,
listdir("*.app"). I know the glob is kind of unix shell style expanding, but
my program is running under windows, it's my tiny script to walk through a
huge directory in my NAS. And there are many directories named with "[]" and
"()" characters amid. May the only way is to program a filter on the
listdir.
On Wed, Apr 14, 2010 at 6:34 PM, Shashwat Anand <rep...@bugs.python.org>wrote:
>
> Shashwat Anand <anand.shash...@gmail.com> added the comment:
>
> glob module does not provide what you want.
> As a workaround you can try:
>
> os.listdir("c:\abc\afolderwith[test]")
>
> 07:02:52 l0nwlf-MBP:Desktop $ ls -R test\[123\]/
> 1 2 3
> >>> os.listdir('/Users/l0nwlf/Desktop/test[123]')
> ['1', '2', '3']
>
> Changing type to 'Feature Request'
>
> ----------
> status: pending -> open
> type: behavior -> feature request
>
> _______________________________________
> Python tracker <rep...@bugs.python.org>
> <http://bugs.python.org/issue8402>
> _______________________________________
>
----------
title: glob returns empty list with "[" character in the folder name -> glob
returns empty list with "
Added file: http://bugs.python.org/file16925/unnamed
_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue8402>
_______________________________________
Well, the listdir doesn't support "wildcard", for example,
listdir("*.app"). I know the glob is kind of unix shell style
expanding, but my program is running under windows, it's my tiny script to
walk through a huge directory in my NAS. And there are many directories named
with "[]" and "()" characters amid. May the only way is to
program a filter on the listdir.<br>
<br><div class="gmail_quote">On Wed, Apr 14, 2010 at 6:34 PM, Shashwat Anand
<span dir="ltr"><<a
href="mailto:rep...@bugs.python.org">rep...@bugs.python.org</a>></span>
wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
Shashwat Anand <<a
href="mailto:anand.shash...@gmail.com">anand.shash...@gmail.com</a>> added
the comment:<br>
<br>
glob module does not provide what you want.<br>
As a workaround you can try:<br>
<br>
os.listdir("c:\abc\afolderwith[test]")<br>
<br>
07:02:52 l0nwlf-MBP:Desktop $ ls -R test\[123\]/<br>
1 2 3<br>
>>> os.listdir('/Users/l0nwlf/Desktop/test[123]')<br>
['1', '2', '3']<br>
<br>
Changing type to 'Feature Request'<br>
<br>
----------<br>
status: pending -> open<br>
type: behavior -> feature request<br>
<div><div></div><div class="h5"><br>
_______________________________________<br>
Python tracker <<a
href="mailto:rep...@bugs.python.org">rep...@bugs.python.org</a>><br>
<<a href="http://bugs.python.org/issue8402"
target="_blank">http://bugs.python.org/issue8402</a>><br>
_______________________________________<br>
</div></div></blockquote></div><br>
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com