Mohammed Hamada
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\Device UpdateLogs \Server\Au dit\imageU pdates)
The Public folder is c:\PublicFolder.
Would appreciate your help.
Thanks
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\Device
The Public folder is c:\PublicFolder.
Would appreciate your help.
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.
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.
ASKER
No it worked, actually the folder path was just misspelled! I have fixed it and it worked perfectly right.
Thanks a lot
Thanks a lot
ASKER
OPppps, sorry I assigned the points to the wrong person, I have requested moderators attention to re-assign points to oBdA.
Thanks
Thanks
ASKER
thanks
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.