Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Script to search and move

Status
Not open for further replies.

danhole

Technical User
Dec 19, 2005
7
GB
Does anyone know if it is possible to do the following using VBscvipt?

I have the need for a script that will prompt me for a search string then search within subfolders for the string within the files.
If it finds files containing that string they are then moved to another location but also keeping the subfolder file structure.
Also loging progress would be a bonus?

I await eagerly for any suggestions

Regards

Dan
 
It's possible. Unless you have to search Word documents, you should be able to do everything you want with the File System Object. Do a search on recursive and a search on FSO and/or FileSystemObject.
 
they are just basic text files so should be ok
i have been searching around but having difficulty finding the command to search of file containing found filenames date siz butt not containing a value
 
With the FSO, you can find the filename and compare it vs a search string. You could use InStr on the filename for this. If you need to search the contents of the file, then you have to open the file to read it (also done with the FSO) then check the contents for the search string.

This might help a little:
 
I have looked through that but we are talking thosands of files within subfolders. Surely this will take ages to proses?
they do all have the same extenstion so can narrow it down that way

I have tryed a few example scripts but cant get any working?

does it matter that i am testing this in Vista but will implement on server 2000 box?
 
If you have tried some examples, post what you have tried and explain how they failed and we can help you work out the kinks.

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top