Hello,

I want to do some DIR command with VBscript. The following code is what
i already have:

<code>
Set objFolder = objFSO.GetFolder(DrvLetter & "\")
Set colFiles = objFolder.Files

For Each objFile in colFiles
LogBO = LogBO & objFile.Name & ", " & VbTab & FormatNumber(objFile.Size
* BytesToKB, -1) & "KB, " & VbTab & objFile.DateLastModified & VbCrLf

Next
</code>

This script enumerate the file name, the filesize in KB's and the Last
Modified date.

Now i want to enumerate only the files beginning with export*.mdb. How
can I do this?

Thnx in advance,

Cees van Altena

Re: Enumerating files in a folder beginning with ... by wildarmz

wildarmz
Thu Dec 07 05:22:52 CST 2006

i think if you add the line as below, it should work..

For Each objFile in colFiles
If left(FileName,7) = "Export" Then
LogBO = LogBO & objFile.Name & ", " & VbTab & FormatNumber(objFile.Size
BytesToKB, -1) & "KB, " & VbTab & objFile.DateLastModified & VbCrLf


Cezus wrote:
> Hello,
>
> I want to do some DIR command with VBscript. The following code is what
> i already have:
>
> <code>
> Set objFolder = objFSO.GetFolder(DrvLetter & "\")
> Set colFiles = objFolder.Files
>
> For Each objFile in colFiles
> LogBO = LogBO & objFile.Name & ", " & VbTab & FormatNumber(objFile.Size
> * BytesToKB, -1) & "KB, " & VbTab & objFile.DateLastModified & VbCrLf
>
> Next
> </code>
>
> This script enumerate the file name, the filesize in KB's and the Last
> Modified date.
>
> Now i want to enumerate only the files beginning with export*.mdb. How
> can I do this?
>
> Thnx in advance,
>
> Cees van Altena


Re: Enumerating files in a folder beginning with ... by Cezus

Cezus
Thu Dec 07 07:20:01 CST 2006

I tried youre solution but it didnt work. He didnt let me see any file
name.
However VBScript did see youre FileName as a variable, I dont know if
it is important information to you?

with kind regards

Cees van Altena


wildarmz schreef:

> i think if you add the line as below, it should work..
>
> For Each objFile in colFiles
> If left(FileName,7) = "Export" Then
> LogBO = LogBO & objFile.Name & ", " & VbTab & FormatNumber(objFile.Size
> BytesToKB, -1) & "KB, " & VbTab & objFile.DateLastModified & VbCrLf
>
>
> Cezus wrote:
> > Hello,
> >
> > I want to do some DIR command with VBscript. The following code is what
> > i already have:
> >
> > <code>
> > Set objFolder = objFSO.GetFolder(DrvLetter & "\")
> > Set colFiles = objFolder.Files
> >
> > For Each objFile in colFiles
> > LogBO = LogBO & objFile.Name & ", " & VbTab & FormatNumber(objFile.Size
> > * BytesToKB, -1) & "KB, " & VbTab & objFile.DateLastModified & VbCrLf
> >
> > Next
> > </code>
> >
> > This script enumerate the file name, the filesize in KB's and the Last
> > Modified date.
> >
> > Now i want to enumerate only the files beginning with export*.mdb. How
> > can I do this?
> >
> > Thnx in advance,
> >
> > Cees van Altena


Re: Enumerating files in a folder beginning with ... by Tom

Tom
Thu Dec 07 11:51:16 CST 2006

It should be ...

if lcase(left(objFile.Name,7)) = "export" Then
LogBO = ...
end if

I also added the lcase() to make it case insensitive.

Tom Lavedas
=============
http://members.cox.net/tglbatch/wsh/

Cezus wrote:
> I tried youre solution but it didnt work. He didnt let me see any file
> name.
> However VBScript did see youre FileName as a variable, I dont know if
> it is important information to you?
>
> with kind regards
>
> Cees van Altena
>
>
> wildarmz schreef:
>
> > i think if you add the line as below, it should work..
> >
> > For Each objFile in colFiles
> > If left(FileName,7) = "Export" Then
> > LogBO = LogBO & objFile.Name & ", " & VbTab & FormatNumber(objFile.Size
> > BytesToKB, -1) & "KB, " & VbTab & objFile.DateLastModified & VbCrLf
> >
> >
> > Cezus wrote:
> > > Hello,
> > >
> > > I want to do some DIR command with VBscript. The following code is what
> > > i already have:
> > >
> > > <code>
> > > Set objFolder = objFSO.GetFolder(DrvLetter & "\")
> > > Set colFiles = objFolder.Files
> > >
> > > For Each objFile in colFiles
> > > LogBO = LogBO & objFile.Name & ", " & VbTab & FormatNumber(objFile.Size
> > > * BytesToKB, -1) & "KB, " & VbTab & objFile.DateLastModified & VbCrLf
> > >
> > > Next
> > > </code>
> > >
> > > This script enumerate the file name, the filesize in KB's and the Last
> > > Modified date.
> > >
> > > Now i want to enumerate only the files beginning with export*.mdb. How
> > > can I do this?
> > >
> > > Thnx in advance,
> > >
> > > Cees van Altena


Re: Enumerating files in a folder beginning with ... by Ayush

Ayush
Thu Dec 07 14:05:08 CST 2006

Replied to [Cezus]s message :
-----------------------------------------------------------

> Now i want to enumerate only the files beginning with export*.mdb. How
> can I do this?
---
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder("D:\")
Set colFiles = objFolder.Files

For Each objFile in colFiles
If lCase(Left(objFile.Name,6))="export" Then
If lCase(Right(objFile.Name,4))=".mdb" Then
LogBO = LogBO & objFile.Name & ", " & VbTab & objFile.Size & VbTab &
objFile.DateLastModified & VbCrLf
End iF
End If
Next

MsgBox LogBo
---


See attached file to avoid line wraps.


--
Ayush [ Good :-) Luck ]
-------------
Search - www.Google.com | Wikipedia - http://en.wikipedia.org
Snip your long urls - http://snipurl.com/
-------------


begin 666 Start [Export], End [.mdb].txt
M4V5T(&]B:D933R ]($-R96%T94]B:F5C="@B4V-R:7!T:6YG+D9I;&53>7-T
M96U/8FIE8W0B*0T*4V5T(&]B:D9O;&1E<B ](&]B:D933RY'971&;VQD97(H
M(D0Z7"(I#0I3970@8V]L1FEL97,@/2!O8FI&;VQD97(N1FEL97,-"@T*1F]R
M($5A8V@@;V)J1FEL92!I;B!C;VQ&:6QE<PT*268@;$-A<V4H3&5F="AO8FI&
M:6QE+DYA;64L-BDI/2)E>'!O<G0B(%1H96X-"B @268@;$-A<V4H4FEG:'0H
M;V)J1FEL92Y.86UE+#0I*3TB+FUD8B(@5&AE;@T*3&]G0D\@/2!,;V="3R F
M(&]B:D9I;&4N3F%M92 F("(L("(@)B!68E1A8B F(&]B:D9I;&4N4VEZ92 F
M(%9B5&%B("8@;V)J1FEL92Y$871E3&%S=$UO9&EF:65D("8@5F)#<DQF#0H@
E($5N9"!I1@T*16YD($EF#0I.97AT#0H-"DUS9T)O>"!,;V=";P``
`
end


Re: Enumerating files in a folder beginning with ... by Cezus

Cezus
Fri Dec 08 04:19:59 CST 2006

Both, Thank you. It helped me very much

With Kind Regards

Cees van Altena

>It should be ...
>
> if lcase(left(objFile.Name,7)) = "export" Then
> LogBO = ...
> end if
>
>I also added the lcase() to make it case insensitive.
>
>Tom Lavedas

Ayush schreef:

> Replied to [Cezus]s message :
> -----------------------------------------------------------
>
> > Now i want to enumerate only the files beginning with export*.mdb. How
> > can I do this?
> ---
> Set objFSO = CreateObject("Scripting.FileSystemObject")
> Set objFolder = objFSO.GetFolder("D:\")
> Set colFiles = objFolder.Files
>
> For Each objFile in colFiles
> If lCase(Left(objFile.Name,6))="export" Then
> If lCase(Right(objFile.Name,4))=".mdb" Then
> LogBO = LogBO & objFile.Name & ", " & VbTab & objFile.Size & VbTab &
> objFile.DateLastModified & VbCrLf
> End iF
> End If
> Next
>
> MsgBox LogBo
> ---
>
>
> See attached file to avoid line wraps.
>
>
> --
> Ayush [ Good :-) Luck ]
> -------------
> Search - www.Google.com | Wikipedia - http://en.wikipedia.org
> Snip your long urls - http://snipurl.com/
> -------------
>
>
> begin 666 Start [Export], End [.mdb].txt
> M4V5T(&]B:D933R ]($-R96%T94]B:F5C="@B4V-R:7!T:6YG+D9I;&53>7-T
> M96U/8FIE8W0B*0T*4V5T(&]B:D9O;&1E<B ](&]B:D933RY'971&;VQD97(H
> M(D0Z7"(I#0I3970@8V]L1FEL97,@/2!O8FI&;VQD97(N1FEL97,-"@T*1F]R
> M($5A8V@@;V)J1FEL92!I;B!C;VQ&:6QE<PT*268@;$-A<V4H3&5F="AO8FI&
> M:6QE+DYA;64L-BDI/2)E>'!O<G0B(%1H96X-"B @268@;$-A<V4H4FEG:'0H
> M;V)J1FEL92Y.86UE+#0I*3TB+FUD8B(@5&AE;@T*3&]G0D\@/2!,;V="3R F
> M(&]B:D9I;&4N3F%M92 F("(L("(@)B!68E1A8B F(&]B:D9I;&4N4VEZ92 F
> M(%9B5&%B("8@;V)J1FEL92Y$871E3&%S=$UO9&EF:65D("8@5F)#<DQF#0H@
> E($5N9"!I1@T*16YD($EF#0I.97AT#0H-"DUS9T)O>"!,;V=";P``
> `
> end


Re: Enumerating files in a folder beginning with ... by Ayush

Ayush
Fri Dec 08 15:55:17 CST 2006

Replied to [Cezus]s message :
-----------------------------------------------------------
> Both, Thank you. It helped me very much


You are welcome !



--
Ayush [ Good :-) Luck ]
-------------
Search - www.Google.com | Wikipedia - http://en.wikipedia.org
Snip your long urls - http://snipurl.com/
-------------