Page 1 of 1

search old name in list

Posted: 28 Mar 2011 08:39
by darioit
Hi folks,

I have this new issue.

tree directory:
C:\a
C:\b
C:\c
a lot of file arrive on directory c:\a

every 5 minutes start a bat that do this operation:

1 ) move file from a to b (move c:\a\* c:\b)
2) other process..................
3) move file from b to c (move c:\b\* c:\c)

sometimes some process in step 2 terminate in error, and in directory c:\b the file remain forever.

I like to do write this code for check:

dir /b c:\b\* > list_new.txt
move c:\a\* c:\b\
dir /b c:\b > list.txt

new code to write
for every line in list_new.txt check if already exist in list.txt and send a warning

Regards

Re: search old name in list

Posted: 28 Mar 2011 14:15
by aGerman
FC will do that for you.

Regards
aGerman

Re: search old name in list

Posted: 29 Mar 2011 02:03
by darioit
Thanks aGerman, but I don't need to compare the content of the file, but only the name.

I wrote this code and it seems works fine, any suggestion to improve the code?

Code: Select all

@echo off
set trovato=
del C:\list_old.txt
ren C:\list.txt list_old.txt
dir /b C:\b > C:\list.txt
for /f %%i in ('dir /b c:\b') do findstr /b %%i C:\list_old.txt > nul && set trovato=%%i && call :errore

goto:eof

:errore
echo routine errore %trovato%


Regards
Dario