| 1. |
Solve : compare two folders and find which files are not in both folders? |
|
Answer» Hi, so if the files do not compare would it allow me to make them equal? yesQuote from: marvinengland on May 17, 2010, 03:53:57 AM yes how? Quote from: Khasiar on May 17, 2010, 02:57:16 AM so if the files do not compare would it allow me to make them equal? The comp command will not help you to make the files and folders equal You will manually need to modify the files. C:\test>comp /? Compares the contents of two files or sets of files. COMP [data1] [DATA2] [/D] [/A] [/L] [/N=NUMBER] [/C] [/OFF[LINE]] data1 Specifies location and name(s) of first file(s) to compare. data2 Specifies location and name(s) of second files to compare. /D Displays differences in decimal format. /A Displays differences in ASCII characters. /L Displays line numbers for differences. /N=number Compares only the first specified number of lines in each file. /C Disregards case of ASCII letters when comparing files. /OFF[liNE] Do not skip files with offline attribute set. To compare sets of files, use wildcards in data1 and data2 parameters. C:\test>so why did you write "yes"? Quote from: Khasiar on May 12, 2010, 05:53:18 PM I am trying to find a way to compare two folders I'm sorry we have received no further suggestions of how to compare files and folders with batch commands or other methods. Good LuckOK don't answer. I am sorry the OP got such bad advice. Quote from: marvinengland on May 17, 2010, 01:05:54 PM I'm sorry we have received no further suggestions of how to compare files and folders with batch commands or other methods. Khasiar , Are no suggestions better than the suggestions I offered? My suggestions hurt no one. And many readers benefited from this thread. Khasiar , Thanks for your questions. Please don't allow negative comments from members who have no suggestions discourage questions in the future.Quote members who have no suggestions Ouch! Code: [Select]@echo off for /f "delims=" %%F in ( ' dir /b "folder1" ' ) do ( if not exist "folder2\%%F" copy "folder1\%%F" "folder2" && echo COPIED %%F ) Quote from: Khasiar on May 12, 2010, 05:53:18 PM Hi, I think you want both folders to have the same content. You can do that in a rather complicated batch file. Or just use some utilities that just do that. One of many is the Sync Toy from Microsoft. Or study how the XCOPY command works. Do XCOPY /? at the command prompt.Quote from: Geek-9pm on May 17, 2010, 07:30:51 PM I think you want both folders to have the same content. The comp command shows where the problem is and xcopy will correct the problem. C:\>comp /? Compares the contents of two files or sets of files. COMP [data1] [data2] [/D] [/A] [/L] [/N=number] [/C] [/OFF[liNE]] data1 Specifies location and name(s) of first file(s) to compare. data2 Specifies location and name(s) of second files to compare. /D Displays differences in decimal format. /A Displays differences in ASCII characters. /L Displays line numbers for differences. /N=number Compares only the first specified number of lines in each file. /C Disregards case of ASCII letters when comparing files. /OFF[liNE] Do not skip files with offline attribute set. To compare sets of files, use wildcards in data1 and data2 parameters. C:\> Thanks marvinengland and Salmon Trout, Both your ways work but Marvinengland, Salmon Trouts way is much easier so ill stick with that thanks again guys.Quote from: marvinengland on May 17, 2010, 09:09:06 PM The comp command shows where the problem is and xcopy will correct the problem. And how would you use them together, exactly? and why use comp instead of fc? |
|