Click here for important information about

Check name and move to another dir

Microsoft Windows 2000 professional
April 23, 2010 at 03:18:56
Specs: Windows Server
I have a requirement to write a batch script to check the names of *.log files in a loop to match with 2 substrings (substr can be anywhere in the name), If matches, I need to move the log files to specific folders. Any help would be appreciated. M2, thanks in advance .

See More: Check name and move to another dir

April 23, 2010 at 04:42:39
M2, you got work

Report •

April 23, 2010 at 22:21:40
i guess he gets the "B" string today, i'll try to fill in.
"and" or "or"? (substrngs), case? yadayadayada...
oh well, ...
@echo off & setlocal enabledelayedexpansion
for /f "tokens=*" %%a in ('dir /b *.log ^|findstr /i "str1 str2"') do (
echo move %%a another.dir
::---- end
note that the strings might need escapes

Report •

April 26, 2010 at 02:15:42
Thanks nbrane.

Once I get 2 substrings from the log file name, I need to search in each log file for a string and then process few other actions if I find the string.
Could someone pls help me on this..

Report •
Related Solutions

Ask Question