problem with glob in remote directory or os.walk in remote directory in windos

lameck kassana lkassana at gmail.com
Fri Feb 27 04:02:57 EST 2009


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\v20090225<file://192.168.0.45/loader/Files/file_log/v20090225>
*"):
      file_count += len(files)
print 'Found', file_count, 'files in cwd'
--------------------------------------------------------------------------------------------------------------------------------

the results are Found 435656 files in cwd  --which is impossible since files
are around six thousands daily.
thanks in advance

On Thu, Feb 26, 2009 at 5:15 PM, Steve Holden <steve at holdenweb.com> wrote:

> 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 <file://192.168.0.45/files> how can
> > do it by using glob.glob()
> >
> >>> glob.glob(r"\\houseboy\sholden\*.txt")
> ['\\\\houseboy\\sholden\\pgin1.txt',
> '\\\\houseboy\\sholden\\POSTGRES.TXT',
> '\\\\houseboy\\sholden\\gatesquote.txt',
> '\\\\houseboy\\sholden\\UbuntuWhatNow.txt',
>  '\\\\houseboy\\sholden\\patch001.txt']
> >>> glob.glob(r"\\192.168.2.200\sholden\*.txt")
> ['\\\\192.168.2.200\\sholden\\pgin1.txt',
> '\\\\192.168.2.200\\sholden\\POSTGRES.TXT',
> '\\\\192.168.2.200\\sholden\\gatesquote.txt',
> '\\\\192.168.2.200\\sholden\\UbuntuWhatNow.txt',
> '\\\\192.168.2.200\\sholden\\patch001.txt']
> >>>
>
> Working just fine for me.
>
> regards
>  Steve
> --
> Steve Holden        +1 571 484 6266   +1 800 494 3119
> Holden Web LLC              http://www.holdenweb.com/
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090227/a8b1043f/attachment-0001.html>


More information about the Python-list mailing list