Werbung: SecurityConsole.de verwaltet Ihre Computer mit Security Essentails aus der Cloud!
30 Tage kostenfrei testen und 20% Rabatt für Ihre Bestellung mit Promocode: WBF2685582
(Promocode gültig bis 31.12.2011)

Group:  English: Windows Server » microsoft.public.windows.server.scripting
Thread: Finding files using a partial filename

HTVi
TV Discussion Newsgroups

Finding files using a partial filename
BigBadJohn 5/3/2007 6:35:02 PM
Folks,

I am looking for a way to search a directory for files which contain a
specific string of characters (such as "test" or "msdn") anywhere in the
filename. I am trying to use this script on a Win2K Terminal machine, so I
cannot use the WMI 'LIKE' command.

Help? Please?
Re: Finding files using a partial filename
"Joseph M." <joseph.majzoub[ at ]gmail.com> 5/3/2007 7:36:13 PM
If you're not opposed to using a batch file, it's pretty simple.

dir /s *msdn*

--
Joseph Majzoub
Systems Engineer
ScriptLogic Corporation
www.scriptlogic.com



"BigBadJohn" <BigBadJohn[ at ]discussions.microsoft.com> wrote in message
news:1D0E7895-A4D1-46C8-BB4A-54FF490270D8[ at ]microsoft.com...
[Quoted Text]
> Folks,
>
> I am looking for a way to search a directory for files which contain a
> specific string of characters (such as "test" or "msdn") anywhere in the
> filename. I am trying to use this script on a Win2K Terminal machine, so I
> cannot use the WMI 'LIKE' command.
>
> Help? Please?


Re: Finding files using a partial filename
BigBadJohn 5/3/2007 8:07:02 PM
Actually, I'm looking to write a VBS script to do this; I need to write a
script that locates any files that contain a specific string of characters,
then move that file to a different folder.

"Joseph M." wrote:

[Quoted Text]
> If you're not opposed to using a batch file, it's pretty simple.
>
> dir /s *msdn*
>
> --
> Joseph Majzoub
> Systems Engineer
> ScriptLogic Corporation
> www.scriptlogic.com
>
>
>
> "BigBadJohn" <BigBadJohn[ at ]discussions.microsoft.com> wrote in message
> news:1D0E7895-A4D1-46C8-BB4A-54FF490270D8[ at ]microsoft.com...
> > Folks,
> >
> > I am looking for a way to search a directory for files which contain a
> > specific string of characters (such as "test" or "msdn") anywhere in the
> > filename. I am trying to use this script on a Win2K Terminal machine, so I
> > cannot use the WMI 'LIKE' command.
> >
> > Help? Please?
>
>
>
Re: Finding files using a partial filename
urkec 5/4/2007 2:40:00 PM
I think you can use FSO and InStr function.

set fso = CreateObject _
("Scripting.FileSystemObject")

set folder = fso.GetFolder _
("C:\someFolder\")


for each file in folder.Files

if instr (file.Name, "some value") then
WScript.Echo file.Name
end if

next

--
urkec


"BigBadJohn" wrote:

[Quoted Text]
> Actually, I'm looking to write a VBS script to do this; I need to write a
> script that locates any files that contain a specific string of characters,
> then move that file to a different folder.
>
> "Joseph M." wrote:
>
> > If you're not opposed to using a batch file, it's pretty simple.
> >
> > dir /s *msdn*
> >
> > --
> > Joseph Majzoub
> > Systems Engineer
> > ScriptLogic Corporation
> > www.scriptlogic.com
> >
> >
> >
> > "BigBadJohn" <BigBadJohn[ at ]discussions.microsoft.com> wrote in message
> > news:1D0E7895-A4D1-46C8-BB4A-54FF490270D8[ at ]microsoft.com...
> > > Folks,
> > >
> > > I am looking for a way to search a directory for files which contain a
> > > specific string of characters (such as "test" or "msdn") anywhere in the
> > > filename. I am trying to use this script on a Win2K Terminal machine, so I
> > > cannot use the WMI 'LIKE' command.
> > >
> > > Help? Please?
> >
> >
> >

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net
Suche nach Orten, Städten, Postleitzahlen, Vorwahlen, Kfz-Kennzeichen