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

Steve Holden steve at holdenweb.com
Fri Feb 27 07:16:32 EST 2009


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.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
> 
Please don't use "reply all" - I subscribe to the list, and will see
your posting there. I am pretty sure by now someone has pointed out that
you are adding the lengths of the filenames, and what you instead need is

file_count = len(glob.glob(...))

regards
 Steve
-- 
Steve Holden        +1 571 484 6266   +1 800 494 3119
Holden Web LLC              http://www.holdenweb.com/




More information about the Python-list mailing list