|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|||
|
DOS Batch - Batch file to compare folders and get result to another folder
can anyone help me with comparing files in 2 folders. i want to compare 2 folders and the difference between these two should go to another folder. any idea any one?
|
|
|||
|
i got this:
@ECHO ON SET LOCALFOLDER=C:\1 SET OTHERFOLDER=C:\2 :LOCALKEYTEMP SET FILE=DONE FOR /F "tokens=* delims=" %%G IN ('DIR ^%LOCALFOLDER%\*.*^') DO SET FILE=%%G SET FULLPATHLOCAL="%LOCALFOLDER%\%FILE%" SET FULLPATHOTHER="%OTHERFOLDER%\%FILE%" SET FILE="%FILE%" IF "DONE"==%FILE% GOTO END ECHO N|COMP %FULLPATHLOCAL% %FULLPATHOTHER% IF ERRORLEVEL 1 GOTO DIFFERENTKEYS IF ERRORLEVEL 0 GOTO DELETEBOTH ELETEBOTHDEL /Q %FULLPATHLOCAL% DEL /Q %FULLPATHOTHER% GOTO LOCALKEYTEMP IFFERENTKEYSDEL /Q %FULLPATHLOCAL% COPY FULLPATHOTHER C:\3 /S GOTO LOCALKEYTEMP :END ECHO ALL FILES DELETED IN %LOCALFOLDER% ECHO ALL NON IDENTICAL FILES REMAIN ON %OTHERFOLDER% ::xcopy C:\2\*.* C:\3 /S CLS EXIT but this will not help me in moving the difference to new folder and the loop somehow doesnt' seem to work for more than one file.. |
![]() |
| Viewing: Dev Hardware Forums > SOFTWARE > Programming > DOS Batch - Batch file to compare folders and get result to another folder |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|