fc
command output show the differences in sets that include the first and last equal lines. If you want to get just the different lines, you must achieve the comparison of the files by yourself. The Batch program below do that:
@echo off
setlocal EnableDelayedExpansion
set ftpdir=Z:\FTP\home\
set xdir=Z:\NewDir\
set vtree=v.txt
set vtreecomp=vcomp.txt
:START
if not exist %vtree% dir %ftpdir% /S/B > %vtree%
:VCOMPTREE
dir %ftpdir% /S/B > %vtreecomp%
fc %vtree% %vtreecomp% > nul
if errorlevel 1 (
set "vtreeLine="
< %vtree% (
for /F "delims=" %%a in (%vtreecomp%) do (
if not defined vtreeLine set /P vtreeLine=
if "!vtreeLine!" equ "%%a" (
set "vtreeLine="
) else (
echo %%a
)
)) > queue.txt
exit
)
goto START
This program just manage the case when new files are added to previous tree; it will fail if any file is deleted.