|
server
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Finding files using a partial filename
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? If you're not opposed to using a batch file, it's pretty simple.
dir /s *msdn* Show quote "BigBadJohn" <BigBadJ***@discussions.microsoft.com> wrote in message news:1D0E7895-A4D1-46C8-BB4A-54FF490270D8@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? 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. Show quote "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" <BigBadJ***@discussions.microsoft.com> wrote in message > news:1D0E7895-A4D1-46C8-BB4A-54FF490270D8@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? > > > 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 -- Show quoteurkec "BigBadJohn" wrote: > 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" <BigBadJ***@discussions.microsoft.com> wrote in message > > news:1D0E7895-A4D1-46C8-BB4A-54FF490270D8@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? > > > > > > |
|||||||||||||||||||||||