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: find files which contains certain string

HTVi
TV Discussion Newsgroups

find files which contains certain string
Jurgen Heijnen 6/2/2007 9:01:00 AM
Hello scripters,

Can someone help me creating a script which search for files which contains
a certain string in the filename. the files are placed in 1 directory and
there names differ, an example: 2383737.2006.01.csv of 4443335.2007.04.csv.
Now I need to search the directory for the filename which contains the string
"2007.04", which stands for "april 2007".
Can somebody help or get me started

thank you
regards Jurgen
Re: find files which contains certain string
"Richard Mueller [MVP]" <rlmueller-nospam[ at ]ameritech.nospam.net> 6/2/2007 2:23:34 PM
Jurgen Heijnen wrote:

[Quoted Text]
> Can someone help me creating a script which search for files which
> contains
> a certain string in the filename. the files are placed in 1 directory and
> there names differ, an example: 2383737.2006.01.csv of
> 4443335.2007.04.csv.
> Now I need to search the directory for the filename which contains the
> string
> "2007.04", which stands for "april 2007".
> Can somebody help or get me started

I have an example VBScript program that does this linked here:

http://www.rlmueller.net/FindFiles.htm

--
Richard Mueller
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net
--


Re: find files which contains certain string
"Al Dunbar" <AlanDrub[ at ]hotmail.com.nospaam> 6/2/2007 10:23:43 PM

"Richard Mueller [MVP]" <rlmueller-nospam[ at ]ameritech.nospam.net> wrote in
message news:eBFKdGSpHHA.4112[ at ]TK2MSFTNGP04.phx.gbl...
[Quoted Text]
> Jurgen Heijnen wrote:
>
>> Can someone help me creating a script which search for files which
>> contains
>> a certain string in the filename. the files are placed in 1 directory and
>> there names differ,

I would hope that their names would differ - if not then they'd all be the
same file.

>> an example: 2383737.2006.01.csv of 4443335.2007.04.csv.
>> Now I need to search the directory for the filename which contains the
>> string
>> "2007.04", which stands for "april 2007".
>> Can somebody help or get me started
>
> I have an example VBScript program that does this linked here:
>
> http://www.rlmueller.net/FindFiles.htm

Or, at a command prompt:

dir {folder}\*.2007.04.csv

Or if you want to have a script do something with the file once found,
something like this in a batch script:

pushd {folder}
(set _ym=Enter year and month in yyyy.mm format: )
for %%F in (*.%_ym%.csv) do notepad %%F


/Al


Re: find files which contains certain string
"Richard Mueller [MVP]" <rlmueller-nospam[ at ]ameritech.nospam.net> 6/3/2007 1:48:18 AM

"Al Dunbar" <AlanDrub[ at ]hotmail.com.nospaam> wrote in message
news:uG12vSWpHHA.716[ at ]TK2MSFTNGP05.phx.gbl...
[Quoted Text]
>
> "Richard Mueller [MVP]" <rlmueller-nospam[ at ]ameritech.nospam.net> wrote in
> message news:eBFKdGSpHHA.4112[ at ]TK2MSFTNGP04.phx.gbl...
>> Jurgen Heijnen wrote:
>>
>>> Can someone help me creating a script which search for files which
>>> contains
>>> a certain string in the filename. the files are placed in 1 directory
>>> and
>>> there names differ,
>
> I would hope that their names would differ - if not then they'd all be the
> same file.
>
>>> an example: 2383737.2006.01.csv of 4443335.2007.04.csv.
>>> Now I need to search the directory for the filename which contains the
>>> string
>>> "2007.04", which stands for "april 2007".
>>> Can somebody help or get me started
>>
>> I have an example VBScript program that does this linked here:
>>
>> http://www.rlmueller.net/FindFiles.htm
>
> Or, at a command prompt:
>
> dir {folder}\*.2007.04.csv
>
> Or if you want to have a script do something with the file once found,
> something like this in a batch script:
>
> pushd {folder}
> (set _ym=Enter year and month in yyyy.mm format: )
> for %%F in (*.%_ym%.csv) do notepad %%F
>
>
> /Al
>

Reading Al's answer I just realized I mis-understood the question. The
script I linked searches for files that have a specified string in the file
contents, not in the name of the file. The "dir" command seems the best
solution.

--
Richard Mueller
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net
--


Re: find files which contains certain string
Jurgen Heijnen 6/7/2007 5:38:04 AM
Richard and All,

Thank you very much for you answers, now I can fo further.

best regards,

Jurgen Heijnen

"Richard Mueller [MVP]" wrote:

[Quoted Text]
>
> "Al Dunbar" <AlanDrub[ at ]hotmail.com.nospaam> wrote in message
> news:uG12vSWpHHA.716[ at ]TK2MSFTNGP05.phx.gbl...
> >
> > "Richard Mueller [MVP]" <rlmueller-nospam[ at ]ameritech.nospam.net> wrote in
> > message news:eBFKdGSpHHA.4112[ at ]TK2MSFTNGP04.phx.gbl...
> >> Jurgen Heijnen wrote:
> >>
> >>> Can someone help me creating a script which search for files which
> >>> contains
> >>> a certain string in the filename. the files are placed in 1 directory
> >>> and
> >>> there names differ,
> >
> > I would hope that their names would differ - if not then they'd all be the
> > same file.
> >
> >>> an example: 2383737.2006.01.csv of 4443335.2007.04.csv.
> >>> Now I need to search the directory for the filename which contains the
> >>> string
> >>> "2007.04", which stands for "april 2007".
> >>> Can somebody help or get me started
> >>
> >> I have an example VBScript program that does this linked here:
> >>
> >> http://www.rlmueller.net/FindFiles.htm
> >
> > Or, at a command prompt:
> >
> > dir {folder}\*.2007.04.csv
> >
> > Or if you want to have a script do something with the file once found,
> > something like this in a batch script:
> >
> > pushd {folder}
> > (set _ym=Enter year and month in yyyy.mm format: )
> > for %%F in (*.%_ym%.csv) do notepad %%F
> >
> >
> > /Al
> >
>
> Reading Al's answer I just realized I mis-understood the question. The
> script I linked searches for files that have a specified string in the file
> contents, not in the name of the file. The "dir" command seems the best
> solution.
>
> --
> Richard Mueller
> Microsoft MVP Scripting and ADSI
> Hilltop Lab - http://www.rlmueller.net
> --
>
>
>
RE: find files which contains certain string
Jurgen Heijnen 6/7/2007 7:36:01 AM
Hello Richard and Al,

Thank you for your answer, I'll now have some idea of how to start. I'll let
you now the result.

Best Regards,

Jurgen Heijnen, Netherlands

"Jurgen Heijnen" wrote:

[Quoted Text]
> Hello scripters,
>
> Can someone help me creating a script which search for files which contains
> a certain string in the filename. the files are placed in 1 directory and
> there names differ, an example: 2383737.2006.01.csv of 4443335.2007.04.csv.
> Now I need to search the directory for the filename which contains the string
> "2007.04", which stands for "april 2007".
> Can somebody help or get me started
>
> thank you
> regards Jurgen

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