On Saturday, 21 December 2019 21:46:43 UTC, Ben Hearn wrote:
> Hello all,
>
> I am having a bit of trouble with a string mismatch operation in my tool I am
> writing.
>
> I am comparing a database collection or url quoted paths to the paths on the
> users drive.
>
> These 2 paths look identic
On 12/21/19 8:25 PM, MRAB wrote:
> On 2019-12-22 00:22, Michael Torrie wrote:
>> On 12/21/19 2:46 PM, Ben Hearn wrote:
>>> These 2 paths look identical, one from the drive & the other from an
>>> xml url:
>>> a = '/Users/macbookpro/Music/tracks_new/_NS_2018/J.Staaf -
>>> ¡Móchate! _PromoMix_.wav'
On 2019-12-22 00:22, Michael Torrie wrote:
On 12/21/19 2:46 PM, Ben Hearn wrote:
These 2 paths look identical, one from the drive & the other from an xml url:
a = '/Users/macbookpro/Music/tracks_new/_NS_2018/J.Staaf - ¡Móchate!
_PromoMix_.wav'
On Sun, Dec 22, 2019 at 11:33 AM Michael Torrie wrote:
>
> On 12/21/19 2:46 PM, Ben Hearn wrote:
> > These 2 paths look identical, one from the drive & the other from an xml
> > url:
> > a = '/Users/macbookpro/Music/tracks_new/_NS_2018/J.Staaf - ¡Móchate!
> > _PromoMix_.wav'
>
On 12/21/19 2:46 PM, Ben Hearn wrote:
> These 2 paths look identical, one from the drive & the other from an xml url:
> a = '/Users/macbookpro/Music/tracks_new/_NS_2018/J.Staaf - ¡Móchate!
> _PromoMix_.wav'
^^
> b = '/Users/macbookpro
On 12/21/19 4:46 PM, Ben Hearn wrote:
import difflib
print('\n'.join(difflib.ndiff([a], [b])))
- /Users/macbookpro/Music/tracks_new/_NS_2018/J.Staaf - ¡Móchate!
_PromoMix_.wav
?
^^
+ /Users/ma
Ben Hearn writes:
> Hello all,
>
> I am having a bit of trouble with a string mismatch operation in my tool I am
> writing.
>
> I am comparing a database collection or url quoted paths to the paths on the
> users drive.
>
> These 2 paths look identical, one from the drive & the other from an xm
Hello all,
I am having a bit of trouble with a string mismatch operation in my tool I am
writing.
I am comparing a database collection or url quoted paths to the paths on the
users drive.
These 2 paths look identical, one from the drive & the other from an xml url:
a = '/Users/macbookpro/Music
act using Python 3.5. I may be lacking in unicode skills
> > but I do have the sense enough to know the version of Python I am
> > invoking. So I included this screenshot of that so the version of
> > Python and the files list returned by os.walk
> >
> > http://rodperson.c
7;ähnlich', 'löblich']
For file names Python resorts to surrogates whenever a byte does not
translate into a character in the advertised encoding.
> I am in fact using Python 3.5. I may be lacking in unicode skills but I
> do have the sense enough to know the version of Python I a
n I am invoking.
> So I included this screenshot of that so the version of Python and the
> files list returned by os.walk
>
> http://rodperson.com/graphics/uc/files.png
If I create a file that has the U+2019 character in it on my Linux
machine (BtrFS), and do os.walk on it, I see the cha
oking.
So I included this screenshot of that so the version of Python and the
files list returned by os.walk
http://rodperson.com/graphics/uc/files.png
So the fact that it shows as a string and not bytes in the debugger was
throwing me for a loop, in my log section I was trying to determine if
it w
On Sun, 25 Jun 2017 02:23:15 -0700, wxjmfauth wrote:
> Le samedi 24 juin 2017 21:10:47 UTC+2, alister a écrit :
>> On Sat, 24 Jun 2017 14:57:21 -0400, Rod Person wrote:
>>
>> > \xe2\x80\x99,
>>
>> because the file name has been created using "Right single quote"
>> instead of apostrophe, the gly
Steve D'Aprano wrote:
> On Sun, 25 Jun 2017 04:57 pm, Peter Otten wrote:
>> if everything worked correctly? Though I don't understand why the OP
>> doesn't see
>>
>> '06 - Toddâ\x80\x99s Song (Post-Spiderland Song in Progress).flac'
>>
>> which is the repr() that I get.
>
> That's mojibake and
On Sun, 25 Jun 2017 04:57 pm, Peter Otten wrote:
> Steve D'Aprano wrote:
>
>> On Sun, 25 Jun 2017 07:17 am, Peter Otten wrote:
>>
>>> Then I'd fix the name manually...
>>
>> The file name isn't broken.
>>
>>
>> What's broken is parts of the OP's code which assumes that non-ASCII file
>> names
Steve D'Aprano wrote:
> On Sun, 25 Jun 2017 07:17 am, Peter Otten wrote:
>
>> Then I'd fix the name manually...
>
> The file name isn't broken.
>
>
> What's broken is parts of the OP's code which assumes that non-ASCII file
> names are broken...
Hm, the OP says
'06 - Todd\xe2\x80\x99s Song (
On Sun, 25 Jun 2017 07:17 am, Peter Otten wrote:
> Then I'd fix the name manually...
The file name isn't broken.
What's broken is parts of the OP's code which assumes that non-ASCII file names
are broken...
--
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
e
p3 and flac files, everything is working great until
>> > the follow file is found
>> >
>> > '06 - Todd's Song (Post-Spiderland Song in Progress).flac'
>> >
>> > for some reason that I can't understand os.walk() returns this file
great until
> the follow file is found
>
> '06 - Todd's Song (Post-Spiderland Song in Progress).flac'
>
> for some reason that I can't understand os.walk() returns this file
> name as
>
> '06 - Todd\xe2\x80\x99s Song (Post-Spiderland Song in
>
Can os.fsencode and os.fsdecode help? I've seen it somewhere.
I've never used it.
To fix encodings, sometimes I use the module ftfy
Greetings
Andre
--
https://mail.python.org/mailman/listinfo/python-list
til
> > the follow file is found
> >
> > '06 - Todd's Song (Post-Spiderland Song in Progress).flac'
> >
> > for some reason that I can't understand os.walk() returns this file
> > name as
> >
> > '06 - Todd\xe2\x80\x99s Song (Post-Spide
> > the follow file is found
> >
> > '06 - Todd's Song (Post-Spiderland Song in Progress).flac'
> >
> > for some reason that I can't understand os.walk() returns this file
> > name as
> >
> > '06 - Todd\xe2\x80\x99s Song (
c'
>
> for some reason that I can't understand os.walk() returns this file
> name as
>
> '06 - Todd\xe2\x80\x99s Song (Post-Spiderland Song in Progress).flac'
>
> which then causes more hell than a little bit for me. I'm not
> understand why apostrophe(
ong in Progress).flac'
>
> for some reason that I can't understand os.walk() returns this file
> name as
>
> '06 - Todd\xe2\x80\x99s Song (Post-Spiderland Song in Progress).flac'
That's basically a UTF-8 string there:
$ python3
>>> a= b'06 -
reason that I can't understand os.walk() returns this file
name as
'06 - Todd\xe2\x80\x99s Song (Post-Spiderland Song in Progress).flac'
which then causes more hell than a little bit for me. I'm not
understand why apostrophe(') becomes \xe2\x80\x99, or what I can do
about it
ng (Post-Spiderland Song in Progress).flac'
>
> for some reason that I can't understand os.walk() returns this file
> name as
>
> '06 - Todd\xe2\x80\x99s Song (Post-Spiderland Song in Progress).flac'
>
> which then causes more hell than a little bit for m
On Sat, 24 Jun 2017 14:57:21 -0400, Rod Person wrote:
> \xe2\x80\x99,
because the file name has been created using "Right single quote" instead
of apostrophe, the glyphs look identical in many fonts.
--
"If you understand what you're doing, you're not learning anything."
--
Hi,
I'm working on a program that will walk a file system and clean the id3
tags of mp3 and flac files, everything is working great until the
follow file is found
'06 - Todd's Song (Post-Spiderland Song in Progress).flac'
for some reason that I can't understand os.walk
On Thu, 17 Dec 2015 14:03:25 +0100, Siegfried Kaiser wrote:
> I have a problem with os.walk - it does not walk into a mounted cdrom, I
> do not see the cdrom in the walk at all.
> What can I do to walk into cdrom?
1. Are you sure that the directory tree contains the actual mount p
On 17/12/2015 13:03, Siegfried Kaiser wrote:
Hello all,
I have a problem with os.walk - it does not walk into a mounted cdrom, I do
not see the cdrom in the walk at all.
What can I do to walk into cdrom?
Thanks,
Siegfried
Please give us.
1) Your OS.
2) Your code.
3) How you
Hello all,
I have a problem with os.walk - it does not walk into a mounted cdrom, I do
not see the cdrom in the walk at all.
What can I do to walk into cdrom?
Thanks,
Siegfried
--
Siegfried Kaiser
--
https://mail.python.org/mailman/listinfo/python-list
Hi,
I'm using the os.walk function for parsing files from an external mass-storage
such as usbkey.
When i try the following code, i have an error:
from __future__ import unicode_literals
import sys
reload(sys)
sys.setdefaultencoding('utf_8')
for dirname, dirnames, filen
gest() ==
> md5.new(f2.read()).digest()
> if truth == 0:
> print "file copy error"
>
> that would probably work for the single file copy functions. but would
> still breakdown during the for ...os.walk(), again because "fname" is
> a list there
truth == 0:
print "file copy error"
that would probably work for the single file copy functions. but would
still breakdown during the for ...os.walk(), again because "fname" is
a list there, and the crypto functions work 1 file at a time. even
changing crypto functions
.digest() ==
> md5.new(f2.read()).digest()
> if truth == 0:
> print "file copy error"
>
> this worked swimmingly. i moved on to my backupall function, something
> like
> for (path, dirs, files) in os.walk(source):
> #os.walk drills down thru a
t provide quite
as strong assurance that way, but it does get rid of the need to save what
files were processed. You could also do a second os.walk, but of course,
that's subject to issues when one of the trees has been changed by something
other than your copying program.
Finally... Why not
"file copy error"
this worked swimmingly. i moved on to my backupall function, something
like
for (path, dirs, files) in os.walk(source):
#os.walk drills down thru all the folders of source
for fname in dirs:
currentdir = destination+leftover
try:
On Fri, Feb 25, 2011 at 9:40 AM, Gaëtan Podevijn wrote:
> Hello,
> I would like that os.walk() does not walk through hidden directories. I know
> that with topdow = true, I can modify the subdirectory list in place, but
> how should I remove every hidden directory from this p
Hello,
I would like that os.walk() does not walk through hidden directories. I know
that with topdow = true, I can modify the subdirectory list in place, but
how should I remove every hidden directory from this place in list ?
Thank you,
Gaëtan
--
http://mail.python.org/mailman/listinfo/python
_VDM_AMB_V001.0003.exr
>> >
>> > True is, there is like 1000 Files is the directory (C:\log\renderfiles\)
>> >
>> > What Iam looking to is to extract the first part of the filenames as a
>> > list, but I dont want the script to extract it 1000times, I mean
, but I dont want the script to extract it 1000times, I mean I dont
> > need it to extract HPO7_SEQ004_031_VDM_AMB 150 times, because there is
> 150
> > Frames. (not sure if its clear tought)
> >
> > so far, I would like the list to look lik:
> >
> > ["HPO7_
clear tought)
>
> so far, I would like the list to look lik:
>
> ["HPO7_SEQ004_031_VDM_DIF", "HPO7_SEQ004_031_VDM_AMB", etc...]
>
>
> I start to think about that, to try to use a
>
> for (path, dirs, files) in os.walk(path):
> list.append(files)
>
>
> b
]
I start to think about that, to try to use a
for (path, dirs, files) in os.walk(path):
list.append(files)
but this kind of thing will just append the whole 1000 files, thing that I
dont want, and more complicated I dont want the thing after "AMB" or "DIF"
in the name file
[nitpicking one specific point]
In article ,
Steven D'Aprano wrote:
>
>On the other hand a cmp function is specific to sorting, and nothing
>but sorting.
Not quite. cmp() is useful any time you have an expensive comparison
operation and you need to take three different codepaths depending on
t
On Wed, 12 May 2010 19:04:47 +, kj wrote:
> In Terry Reedy
> writes:
>
>>On 5/11/2010 3:49 PM, kj wrote:
>>> PS: I never understood why os.walk does not support hooks for key
>>> events during such a tree traversal.
>
>>Either 1) it is inten
On 5/12/2010 2:52 PM, kj wrote:
In Tim Chase writes:
05/11/2010 09:07 PM, Terry Reedy wrote:
If os.walk were rewritten, it should be as an iterator (generator).
Directory entry and exit functions could still be added as params.
It *is* an iterator/generator. However, I suspect you mean
On May 12, 2:04 pm, kj wrote:
> It seems that a similar "simplicity argument" was invoked
> to strip the cmp option from sort in Python 3. G. Simplicity
> is great, but when the drive for it starts causing useful functionality
> to be thrown out, then it is going too far. Yes, I know that i
In Terry Reedy
writes:
>On 5/11/2010 3:49 PM, kj wrote:
>> PS: I never understood why os.walk does not support hooks for key
>> events during such a tree traversal.
>Either 1) it is intentionally simple, with the expectation that people
>would write there own code for
In Tim Chase writes:
> 05/11/2010 09:07 PM, Terry Reedy wrote:
>> If os.walk were rewritten, it should be as an iterator (generator).
>> Directory entry and exit functions could still be added as params.
>It *is* an iterator/generator. However, I suspect you mean that
&g
05/11/2010 09:07 PM, Terry Reedy wrote:
PS: I never understood why os.walk does not support hooks for key
events during such a tree traversal.
Either 1) it is intentionally simple, with the expectation that people
would write there own code for more complicated uses or 2) no one has
submitted
On 5/11/2010 3:49 PM, kj wrote:
I want implement a function that walks through a directory tree
and performs an analsysis of all the subdirectories found. The
task has two essential requirements that, AFAICT, make it impossible
to use os.walk for this:
1. I need to be able to prune certain
In Tim Chase
writes:
>That said, the core source for os.walk() is a whole 23
>lines of code, it's easy enough to just clone it and add what you
>need...
Thanks, that was a good idea.
~K
--
http://mail.python.org/mailman/listinfo/python-list
On 05/11/2010 02:49 PM, kj wrote:
I want implement a function that walks through a directory tree
and performs an analsysis of all the subdirectories found. The
task has two essential requirements that, AFAICT, make it impossible
to use os.walk for this:
1. I need to be able to prune certain
I want implement a function that walks through a directory tree
and performs an analsysis of all the subdirectories found. The
task has two essential requirements that, AFAICT, make it impossible
to use os.walk for this:
1. I need to be able to prune certain directories from being visited.
2
check whether a directory is in that list and skip the program run
for these.
Something like this (symbolically):
lastrun = map(string.strip, logfile.readlines())
newlog = ... open logfile in append mode ...
for root, dirs, files in os.walk(basedir):
if root not in lastrun:
run pr
Steve Howell wrote:
If that's the case, then you might be able to get away with just
leaving some kind of breadcrumbs whenever you've successfully
processed a directory or a file,
Unless you're indexing a read-only device (whether hardware
read-only like a CD, or permission-wise read-only like
On Wed, 17 Mar 2010 20:08:48 -0700, alex23 wrote:
> Steven D'Aprano wrote:
>> # Untested
>> last_visited = open("last_visited.txt", 'r').read()
>> for root, dirs, files in os.walk(last_visited or basedir):
>> open("last_visited.txt&qu
On Mar 17, 3:04 pm, Keir Vaughan-taylor wrote:
> I am traversing a large set of directories using
>
> for root, dirs, files in os.walk(basedir):
> run program
>
> Being a huge directory set the traversal is taking days to do a
> traversal.
> Sometimes it is the case
Keir Vaughan-taylor wrote:
I am traversing a large set of directories using
for root, dirs, files in os.walk(basedir):
run program
Being a huge directory set the traversal is taking days to do a
traversal.
Sometimes it is the case there is a crash because of a programming
error.
As each
Steven D'Aprano wrote:
> # Untested
> last_visited = open("last_visited.txt", 'r').read()
> for root, dirs, files in os.walk(last_visited or basedir):
> open("last_visited.txt", 'w').write(root)
> run program
Wouldn't
En Wed, 17 Mar 2010 19:04:14 -0300, Keir Vaughan-taylor
escribió:
I am traversing a large set of directories using
for root, dirs, files in os.walk(basedir):
run program
Being a huge directory set the traversal is taking days to do a
traversal.
Sometimes it is the case there is a crash
On Wed, 17 Mar 2010 15:04:14 -0700, Keir Vaughan-taylor wrote:
> I am traversing a large set of directories using
>
> for root, dirs, files in os.walk(basedir):
> run program
>
> Being a huge directory set the traversal is taking days to do a
> traversal.
> Sometimes
I am traversing a large set of directories using
for root, dirs, files in os.walk(basedir):
run program
Being a huge directory set the traversal is taking days to do a
traversal.
Sometimes it is the case there is a crash because of a programming
error.
As each directory is processed the name
En Fri, 30 Oct 2009 14:50:34 -0300, Sean DiZazzo
escribió:
On Oct 29, 10:17 pm, Chris Rebert wrote:
On Thu, Oct 29, 2009 at 9:53 PM, Peng Yu wrote:
> I don't see a way to avoid walking over directories of certain names
> with os.walk. For example, I don't want os.walk re
Sean DiZazzo wrote:
On Oct 29, 10:17 pm, Chris Rebert wrote:
On Thu, Oct 29, 2009 at 9:53 PM, Peng Yu wrote:
I don't see a way to avoid walking over directories of certain names
with os.walk. For example, I don't want os.walk return files whose
path include '/backup/
On Oct 29, 10:17 pm, Chris Rebert wrote:
> On Thu, Oct 29, 2009 at 9:53 PM, Peng Yu wrote:
> > I don't see a way to avoid walking over directories of certain names
> > with os.walk. For example, I don't want os.walk return files whose
> > path include
Chris Rebert wrote:
On Thu, Oct 29, 2009 at 9:53 PM, Peng Yu wrote:
I don't see a way to avoid walking over directories of certain names
with os.walk. For example, I don't want os.walk return files whose
path include '/backup/'. Is there a way to do so? Otherwise, maybe
On Thu, Oct 29, 2009 at 9:53 PM, Peng Yu wrote:
> I don't see a way to avoid walking over directories of certain names
> with os.walk. For example, I don't want os.walk return files whose
> path include '/backup/'. Is there a way to do so? Otherwise, maybe I
>
I don't see a way to avoid walking over directories of certain names
with os.walk. For example, I don't want os.walk return files whose
path include '/backup/'. Is there a way to do so? Otherwise, maybe I
will have to make my own program. Thank you!
--
http://mail.python.
kj wrote:
In Dave Angel
writes:
[snippetty snip]
Why would you need a special hook when the os.walk() generator yields
exactly once per directory? So whatever work you do on the list of
files you get, you can then put the summary logic immediately after.
I think you're missin
7;ve been
meaning to add a few enhancements to it for a while, so I thought
that in the process I'd port it to Python, using the os.walk
function, but I see that os.walk does not have anything like this
File::Find::find's postprocess hook. Is there a good way to simulate
it (without having t
kj writes:
> I think you're missing the point. The hook in question has to be
> called *immediately after* all the subtrees that are rooted in
> subdirectories contained in the current directory have been visited
> by os.walk.
>
> I'd love to see your "5 lines
cript.
>>>
>>> This maintenance script is getting long in the tooth, and I've been
>>> meaning to add a few enhancements to it for a while, so I thought
>>> that in the process I'd port it to Python, using the os.walk
>>> function, but I see
ng long in the tooth, and I've been
>> meaning to add a few enhancements to it for a while, so I thought
>> that in the process I'd port it to Python, using the os.walk
>> function, but I see that os.walk does not have anything like this
>> File::Find::find&
hat in the process I'd port it to Python, using the os.walk
function, but I see that os.walk does not have anything like this
File::Find::find's postprocess hook. Is there a good way to simulate
it (without having to roll my own File::Find::find in Python)?
TIA!
kynn
Why would
in the process I'd port it to Python, using the os.walk
function, but I see that os.walk does not have anything like this
File::Find::find's postprocess hook. Is there a good way to simulate
it (without having to roll my own File::Find::find in Python)?
TIA!
kynn
--
http://mail.python.org/mailman/listinfo/python-list
for a while, so I thought
> that in the process I'd port it to Python, using the os.walk
> function, but I see that os.walk does not have anything like this
> File::Find::find's postprocess hook. Is there a good way to simulate
> it (without having to roll my own File::Fin
> On Tue, Aug 4, 2009 at 10:48 PM, Chris Rebert wrote:
>> On Tue, Aug 4, 2009 at 7:06 PM, Michael Savarese wrote:
>> > Greetings
>> > Python newbie here, and thanks to all who have helped me previously.
>> > Is there a way of grabbing file attributes while trav
On Tue, Aug 4, 2009 at 7:06 PM, Michael Savarese wrote:
> Greetings
> Python newbie here, and thanks to all who have helped me previously.
> Is there a way of grabbing file attributes while traversing with os.walk()?
> It would be advantageous to have date modified and file size al
Greetings
Python newbie here, and thanks to all who have helped me previously.
Is there a way of grabbing file attributes while traversing with os.walk()?
It would be advantageous to have date modified and file size along with the
file name.
If anyone can point me in the right direction, I
En Thu, 25 Jun 2009 11:15:15 -0300, Amos Anderson
escribió:
Thank you. That works very well when writing to a text file but what is
the
equivalent when writing the information to stdout using print?
See this recent post:
http://comments.gmane.org/gmane.comp.python.general/627850
--
Gabri
codecs.charmap_encode(input,self.errors,encoding_table)[0]
>> UnicodeEncodeError: 'charmap' codec can't encode character '\u200b' in
>> position
>> 30: character maps to
>>
>> Code is as follows...
>> import os
>> f = open("
harmap' codec can't encode character '\u200b' in
position
30: character maps to
Code is as follows...
import os
f = open("dirlist.txt", 'w')
for root, dirs, files in os.walk("C:\\Users\\Filter\\"):
f.write("root:{0}\n".format(root)
s follows...
import os
f = open("dirlist.txt", 'w')
for root, dirs, files in os.walk("C:\\Users\\Filter\\"):
f.write("root:{0}\n".format(root))
f.write("dirs:\n")
for i in dirs:
f.write("dir:{0}\n".format(i))
f.w
lameck kassana wrote:
> At last i did it it was this wrong line file_count += len(files) ---it
> supposed to be file_count+=1
> but thanks for help ya python masters .Steven Holden thanks very
> very much for your tip about raw string
>
Lameck:
Please note that
file_count = 0
for files in
lameck kassana wrote:
> now it is working but i wonder it brings higher number of count as if it
> counts files in wholes computer can you check in my code and correct me
>
> import glob
> import os
> file_count=0
> for files in glob.glob(r"\\192.16
At last i did it it was this wrong line file_count += len(files) ---it
supposed to be file_count+=1
but thanks for help ya python masters .Steven Holden thanks very very
much for your tip about raw string
On Fri, Feb 27, 2009 at 12:43 PM, Gabriel Genellina
wrote:
> En Fri, 27 Feb 2009 07:02
En Fri, 27 Feb 2009 07:02:57 -0200, lameck kassana
escribió:
now it is working but i wonder it brings higher number of count as if it
counts files in wholes computer can you check in my code and correct me
import glob
import os
file_count=0
fo
now it is working but i wonder it brings higher number of count as if it
counts files in wholes computer can you check in my code and correct me
import glob
import os
file_count=0
for files in
glob.glob(r"\\192.168.0.45\loader\Files\file_log\v20090
lameck kassana wrote:
> ok my original question is how can count the files of ceratin pattern(eg
> *.txt) in remote directory .It seems use of glob.glob() for remote
> directory is not working .Example I want to count the files in following
> shared folder \\192.168.0.45\files how can
> do it by u
ok my original question is how can count the files of ceratin pattern(eg
*.txt) in remote directory .It seems use of glob.glob() for remote
directory is not working .Example I want to count the files in following
shared folder \\192.168.0.45\files how can do it
by using glob.glob()
On Thu, Feb 26
lameck kassana wrote:
> i am trying to write script which will count files for remote directory
> which having certain pattern.
>
Please refrain from repeating questions. When you posted this a reply
had already been made to your original posting. Remember, this isn't a
paid help desk ...
regard
file_string)
File.close()
----
the problem the glob.glob() does not work in remotely directory especially
in window environment i don't know why??
i also try os.walk() for remote directory it faile
tem, choose/make a simple directory structure to use as your root
for os.walk(). Also, you must start from the top most directory
level, like /test. /tmp/test as a root will not work (yet). :)
I wanted to know if I could use os.walk() to construct an object based
off of a directory tree. So, the fo
D wrote:
Ok, my brain's apparently not working right today.. what I'd like to
do is allow the user to specify a directory to exclude (ex- "C:\temp
\test") - then, when os.walk gets to "C:\temp\test", it excludes that
directory and all its subdirectories (so, "C
)
> continue
>
> WARNING: untest code
> - Show quoted text -
>
> On Tue, Oct 21, 2008 at 6:13 PM, D <[EMAIL PROTECTED]> wrote:
> > Ok, my brain's apparently not working right today.. what I'd like to
> > do is allow the user to specify a directory to exc
t; Ok, my brain's apparently not working right today.. what I'd like to
> do is allow the user to specify a directory to exclude (ex- "C:\temp
> \test") - then, when os.walk gets to "C:\temp\test", it excludes that
> directory and all its subdirectories (so,
Ok, my brain's apparently not working right today.. what I'd like to
do is allow the user to specify a directory to exclude (ex- "C:\temp
\test") - then, when os.walk gets to "C:\temp\test", it excludes that
directory and all its subdirectories (so, "C:\temp\my
D wrote:
Hello,
How can one exclude a directory (and all its subdirectories) when
running os.walk()?
Thanks,
Doug
for base, dirs, files in os.walk('wherever'):
if 'RCS' in dirs:
dirs.remove('RCS')
As described in the os.walk docs.
--Scott
D wrote:
Hello,
How can one exclude a directory (and all its subdirectories) when
running os.walk()?
Just remove it from the dirnames yielded:
import os
for dirpath, dirnames, filenames in os.walk ("c:/temp"):
print dirpath
if "archive" in dirnames:
dirnames.remov
1 - 100 of 262 matches
Mail list logo