From: Leon on
Hi

I'm searching through severel servers on in severel folders.
Want newest file LastModified time stamps.

In the folders are files wiht differents filename patterns in (same
folder)
so I'm having path in one array and pattern in another array

In some folders there are more than 800 files.
This is very slow over network -up to 5 minutes.

When copying these files to c:\temp on local machine its very fast.

So what I'm looking for is a faster way to do this.
Do somebody have that experience?


sub TimeStampNewestFile(Fldr,FileNameMask,idx)
set
oFolder=createobject("scripting.filesystemobject").getfolder(Fldr)
for each aFile In oFolder.Files
If NewestFileInFolder = "" then
Set NewestFileInFolder = aFile
else
if FileNameMask = ucase(left(aFile.name,len(FileNameMask)))
then
If aNewestFileInFolder.DateLastModified <
aFile.DateLastModified Then
Set NewestFileInFolder = aFile
m_FileName = aFile
TimeStampArrayLastModified(idx) =
aFile.DateLastModified
end If
end if
end If
next
end sub


Cheers
From: Pegasus [MVP] on


"Leon" <kim.zethsen(a)gmail.com> wrote in message
news:a3a7c479-ceb2-4c75-a17d-ec5c49f9525d(a)g26g2000yqn.googlegroups.com...
> Hi
>
> I'm searching through severel servers on in severel folders.
> Want newest file LastModified time stamps.
>
> In the folders are files wiht differents filename patterns in (same
> folder)
> so I'm having path in one array and pattern in another array
>
> In some folders there are more than 800 files.
> This is very slow over network -up to 5 minutes.
>
> When copying these files to c:\temp on local machine its very fast.
>
> So what I'm looking for is a faster way to do this.
> Do somebody have that experience?
>
>
> sub TimeStampNewestFile(Fldr,FileNameMask,idx)
> set
> oFolder=createobject("scripting.filesystemobject").getfolder(Fldr)
> for each aFile In oFolder.Files
> If NewestFileInFolder = "" then
> Set NewestFileInFolder = aFile
> else
> if FileNameMask = ucase(left(aFile.name,len(FileNameMask)))
> then
> If aNewestFileInFolder.DateLastModified <
> aFile.DateLastModified Then
> Set NewestFileInFolder = aFile
> m_FileName = aFile
> TimeStampArrayLastModified(idx) =
> aFile.DateLastModified
> end If
> end if
> end If
> next
> end sub
>
>
> Cheers

Use psexec.exe (www.sysinternals.com) to execute your script locally on each
machine.

From: X22degg5 on
"Leon" <kim.zethsen(a)gmail.com> wrote in message
news:a3a7c479-ceb2-4c75-a17d-ec5c49f9525d(a)g26g2000yqn.googlegroups.com...
> Hi
>
> I'm searching through severel servers on in severel folders.
> Want newest file LastModified time stamps.
>
> In some folders there are more than 800 files.
> This is very slow over network -up to 5 minutes.
>
> When copying these files to c:\temp on local machine its very fast.
>
> So what I'm looking for is a faster way to do this.
> Do somebody have that experience?
>

I had a different scenareo, but was trying the same thing, doing a "for
each".
Wound up going to command prompt. Have a couple of command prompt windows
flashing, but the process gets done lickety split. In my case, I only
needed some file names (complete path) loaded into an array. Maybe this
will give you some ideas. I was using dir /b, to get time stamps maybe
dir /a /od ?
'-------
Dim MyArray()
xarr = 0
Call ShowFileList(\\srvr01\ErrC")
call ShowFileList("\\srvr01\ErrG")
call ShowFileList("\\srvr01\ErrL")
call ShowFileList("\\srvr01\ErrM")
call ShowFileList("\\srvr01\ErrP")

'-----
Function ShowFileList(folderspec)
Dim fso, f, f1, fc, s
Dim oExec
Set oExec = WinSh.Exec("cmd /c dir /b " & chr(34) & chr(34) & chr(34) &
folderspec & chr(34) & chr(34) & chr(34) & " 2>&1")
''' Replacement hack for performance
Do While oExec.StdOut.AtEndOfStream <> True
' Wscript.Echo oExec.StdOut.ReadLine
xout = oExec.StdOut.ReadLine
xxout = folderspec & "\" & xout
ReDim Preserve MyArray(xarr)
s = s & xxout
s = s & "<BR>" & vbCRLF
Myarray(xarr) = xxout
' wscript.echo xxout
xarr=xarr + 1
Loop
ShowFileList = s
End Function


From: Leon on
Hi Pegasus

Thanks for the answer - unfortunately the link did't work for me?

Cheers

On 10 Mar., 20:24, "Pegasus [MVP]" <n...(a)microsoft.com> wrote:
> "Leon" <kim.zeth...(a)gmail.com> wrote in message
>
> news:a3a7c479-ceb2-4c75-a17d-ec5c49f9525d(a)g26g2000yqn.googlegroups.com...
>
>
>
>
>
> > Hi
>
> > I'm searching through severel servers on in severel folders.
> > Want newest file LastModified time stamps.
>
> > In the folders are files wiht differents filename patterns in (same
> > folder)
> > so I'm having path in one array and pattern in another array
>
> > In some folders there are more than 800 files.
> > This is very slow over network  -up to 5 minutes.
>
> > When copying these files to c:\temp on local machine its very fast.
>
> > So what I'm looking for is a faster way to do this.
> > Do somebody have that experience?
>
> > sub TimeStampNewestFile(Fldr,FileNameMask,idx)
> >   set
> > oFolder=createobject("scripting.filesystemobject").getfolder(Fldr)
> >   for each aFile In oFolder.Files
> >      If NewestFileInFolder = "" then
> >         Set NewestFileInFolder = aFile
> >      else
> >         if FileNameMask = ucase(left(aFile.name,len(FileNameMask)))
> > then
> >            If aNewestFileInFolder.DateLastModified <
> > aFile.DateLastModified Then
> >               Set NewestFileInFolder = aFile
> >               m_FileName = aFile
> >               TimeStampArrayLastModified(idx) =
> > aFile.DateLastModified
> >            end If
> >         end if
> >      end If
> >   next
> > end sub
>
> > Cheers
>
> Use psexec.exe (www.sysinternals.com) to execute your script locally on each
> machine.- Skjul tekst i anførselstegn -
>
> - Vis tekst i anførselstegn -

From: Auric__ on
On Thu, 11 Mar 2010 14:13:47 GMT, Leon wrote:

> Thanks for the answer - unfortunately the link did't work for me?

(In the future, put your replies at the bottom of the post.)

http://technet.microsoft.com/sysinternals/

You can connect to this URL as a network drive and run the programs directly
from the server, or download them as normal from your browser:
http://live.sysinternals.com/

--
UFO's are real. The Air Force doesn't exist.