Computing.Net > Forums > Windows 2000 > Find String in Folder and copy file

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Find String in Folder and copy file

Reply to Message Icon

Name: Claudio (by snooze11)
Date: December 14, 2006 at 03:27:53 Pacific
OS: w2k
CPU/Ram: 2 GHZ
Product: hp
Comment:

Hi, I would like to do the following and I am totally lost right now:

I have folder a) with lots of files
I have folder b) which is empty

I want to search all files in folder a) for a string "blablabla" and if string exists in file then copy the file to folder b)

I would be glad for help here, since I am a bit lost.

Thanks
Claudio



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: December 14, 2006 at 03:46:10 Pacific
Reply:

@echo off
setLocal EnableDelayedExpansion

pushd d:\a
for /f "tokens=*" %%F in ('dir /b/a-d') do (
type %%F | find "blablabla" > nul
if not errorlevel 1 copy "%%F" d:\b
)
popd



=====================================
If at first you don't succeed, you're about average.

M2



0

Response Number 2
Name: Claudio (by snooze11)
Date: December 14, 2006 at 04:37:05 Pacific
Reply:

Hi there,

thanks a lot! Well I am average, but I suceeded right away anyhow. :-))))Must be pure luck.

Thanks again!!
Claudio


0

Response Number 3
Name: Curt R
Date: December 14, 2006 at 09:10:40 Pacific
Reply:

Not luck, Mechanix is the man to go to when you need a batchfile!

The other alternative is to open Windows Explorer, right click on the folder you wish to search, select "Search" from the drop down menu and when the search window opens, enter your search string in the "A word or phrase in the file:" box and click on "Search".


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


usb icon Don't let login



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Windows 2000 Forum Home


Sponsored links

Ads by Google


Results for: Find String in Folder and copy file

error copying file or folder www.computing.net/answers/windows-2000/error-copying-file-or-folder/46470.html

Error copying file or folder - help www.computing.net/answers/windows-2000/error-copying-file-or-folder-help/46432.html

copying files to floppy and windows 2000 www.computing.net/answers/windows-2000/copying-files-to-floppy-and-windows-2000/16392.html