Solved

advanced search for keywords in windows

Posted on 2013-12-17
7
140 Views
Last Modified: 2014-01-02
I have a folder on a windows 2008 r2 server file share containing 300 text documents. i need to filter the number of text documents to just those that contain the word "back". Can anyone think of a way to do this, ideally to copy the files that contain back to a seperate folder or something?
0
Comment
Question by:pma111
  • 5
  • 2
7 Comments
 
LVL 19

Accepted Solution

by:
jss1199 earned 500 total points
ID: 39724035
See the below vbs script.  copy to notepad and save as .vbs. Change C:\folder and C:\users\xxx\desktop to paths of your choice.

setlocal enabledelayedexpansion
for /r C:\folder %%a in (*.txt) do (
find "back" "%%a"
if !errorlevel!==0 copy "%%a" "C:\users\xxx\Desktop" /y
)

Open in new window

0
 
LVL 3

Author Comment

by:pma111
ID: 39724041
Thanks. Can you explain what it is doing as I am not a scripter?

What folder is it copying the results too?

And say if you have 1 txt document that contains that word say 5 times, does it copy the file 5 times, or just once?
0
 
LVL 19

Expert Comment

by:jss1199
ID: 39724059
In the second line, you will see that it is searching C:\ folder for all text files (.txt).  In the third line, I;ve specified that all files containing the string "back" be copied to the path on line four - "C:\users\xxx\Desktop".

Copies from: C:\folder
Copies to: C:\users\xxx\Desktop

If a file has multiple instances of "back", only one file will be copied.
0
Are your end users making ugly email signatures?

Have you left it up to your end users to create their own email signatures? Are they forgetting to add the company logo or using garish font colors? Take control and ensure all users have the same email signature.

 
LVL 3

Author Comment

by:pma111
ID: 39724065
Will give it a go! Thanks
0
 
LVL 3

Author Comment

by:pma111
ID: 39724084
i amended the paths accordingly, it as filtered.vbs and opened command prompt

ran the following command

cscript filtered.vbs (hit enter)

and the error states "expected identifier"? Any ideas?
0
 
LVL 3

Author Comment

by:pma111
ID: 39726073
any feedback to the error message provided?
0
 
LVL 3

Author Comment

by:pma111
ID: 39728936
are you still monitoring this one?
0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently Microsoft released a brand new function called CONCAT. It's supposed to replace its predecessor CONCATENATE. But how does it work? And what's new? In this article, we take a closer look at all of this - we even included an exercise file for…
How to record audio from input sources to your PC – connected devices, connected preamp to record vinyl discs, streaming media, that play through your audio card: Vista, Windows 7, Windows 8, Windows 8.1 and Windows 10 – both 32 bit & 64.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now