Robert Klemme
5/14/2007 12:44:00 PM
On 14.05.2007 14:18, Rebhan, Gilbert wrote:
>
> Hi, Robert
>
> -----Original Message-----
> From: Robert Klemme [mailto:shortcutter@googlemail.com]
> Sent: Monday, May 14, 2007 12:20 PM
> To: ruby-talk ML
> Subject: Re: slow file access with mapped drives ?!
>
> /*
> Why don't you just do
>
> Dir.glob("//servername/c$/targetdir/**/"<<config['targetfilepattern']).e
> ach
> do |file|
> */
>
> Because i need to have the targetdirs flexible, for example i have in
> my yaml =
>
> targetdirs:
> - Y:/tempwork
> - T:/rubytest
> - //wvp10175/c$/SCM_Server
??? The code you posted had no dynamic piece there. Did you maybe mean
to write
Dir.chdir("//servername/c$/#{dir}")
> /*
> Btw, I don't see any reference to block variable "dir" is this on
> purpose?
> */
>
> config['targetdirs'].each do |dir|
> Dir.chdir(dir)
> Dir.glob("**/"<<config['targetfilepattern']).each do |file
> ..
> end
> ..end
That was not in the code you posted.
>> any alternatives to Dir.glob ?
>
> /*
> Find.find - but don't expect that it's faster because the slowness lies
> in file system accesses. Network drives are inherently slower than
> local disks.
> */
>
> it runs in almost half the time, much quicker :-)
.... which might be due to the fact that your new code doesn't do the
chdir! You changed multiple parameters at the same time so it's hard to
attribute the perceived performance change to any one parameter.
> thanks for the pointer !! , now i have =
>
> config['targetdirs'].each do |dir|
> Find.find(dir) do |f|
> if f =~ /#{config['targetfilepattern']}/
> puts "... processing "<<f
> filesed!(config['replacefrom'],s,f)
> end
> end
> end
Please make sure you post the code you are actually testing - otherwise
everybody else will have a hard time understanding what's going on let
alone come up with helpful replies.
Regards
robert