Comparing Two Folders and its Subfolder batch file

前端 未结 4 1735
渐次进展
渐次进展 2021-02-09 00:27

I have two folders that contain all the same files and subfolders, but the conents inside each file may have changed. I want to write a batch file that will search through each

4条回答
  •  故里飘歌
    2021-02-09 00:41

    I'm having better luck with the following batch file. The path names have to completely match though; so only the Drive Letter differs.

    Mapping a shared network folder may make this easier. I can't say for sure for your case.

    '--- setlocal set "folder1=D:\User\Public" set "Drv2=E:" set "fileMask=*"

    setlocal
     set "folder1=:\\"
     set "Drv2=:"
     set "LogFile=\User\\"
    
    ECHO "the '>' may OVER WRITE or make a ~NEW~ File for the results" > "%LogFile%"
    ECHO " '>>' adds to the end of the file >> "%LogFile%"
    
    FOR /R %folder1% %%A in ( *.* ) DO FC "%%A" "%Drv2%%%~pnxA" 1>> "%LogFile%" 2>&1
    

    If you wish to note what is going to be the command for testing, you can try inserting ECHO after DO. You can drop the 1>>... stuff to see the result on screen, instead of having to open the output file.

提交回复
热议问题