Link to home
Start Free TrialLog in
Avatar of Mohammed Hamada
Mohammed HamadaFlag for Portugal

asked on

Batch file to check certain word in a folder full of files (Reports) and copy them to a different folder on the network

Hello Experts

I need a batch file that would check for the word (HP) in a folder full of daily reports, the batch would check inside of every file if there's a word HP . if its found, the batch will copy the file to a different folder that's publicly shared on the network.

This should happen on daily basis.

The folder path if requested is (C:\1-WebServices-1\DeviceUpdateLogs\Server\Audit\imageUpdates)

The Public folder is c:\PublicFolder.

Would appreciate your help.

Thanks
ASKER CERTIFIED SOLUTION
Avatar of oBdA
oBdA

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Question - is HP unique enough to distinguish files?
Can this appear anywhere in the file or only a specific location?

For instance one file could contain

HP Deskjet

And another could contain

index.php

Both will match on the HP part but might not yield the required results.
Avatar of Mohammed Hamada

ASKER

Hi oBdA

I have tried it but it didn't work. I copy it to notepad and removed the ECHO in line 11 then saved as copy.bat on desktop
run it as administrator... but nothing happened.

I should mention maybe that i'm on Windows 2012! could that affect the batch file? even though no errors were reported. I didn't get anything.
No it worked, actually the folder path was just misspelled! I have fixed it and it worked perfectly right.

Thanks a lot
OPppps, sorry I assigned the points to the wrong person, I have requested moderators attention to re-assign points to  oBdA.

Thanks
thanks