Forums before death by AOL, social media and spammers... "We can't have nice things"
|    alt.msdos.batch    |    Fun with MS-DOS batch files    |    42,547 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 42,142 of 42,547    |
|    Neil to Herbert Kleebauer    |
|    Re: List of NOT duplicate files    |
|    13 Mar 23 21:00:20    |
      XPost: alt.comp.os.windows-10       From: neil@myplaceofwork.com              Herbert Kleebauer wrote:              >> What I do now is compare time stamps of the resulting combined folder.       >> But sometimes the time stamps aren't what I would have thought they'd be.       >       > You just answered your own question (but don't use the name       > "list.txt" or it will also be listed as new text file):       > While in directory b\ enter at the command prompt (but first       > delete new.log if it already exists):       >       > for %i in (*.txt) do if not exist ..\a\%i echo %i>>new.log       >       > Or make a batch file which first changes the working       > directory to b\, deletes new.log if it already exists       > and then executes the above line (but double any %).       > Then it doesn't matter where the batch is located and       > you can start it with a double click with the mouse.              Thank you for a way to diff list file names that are in B but not A.       cd B       for %i in (*.txt) do if not exist C:\path\to\A\%i echo %i >> new.log              To which I added the copy I had been using with my manually created diff.       cd B       echo "No" | copy/-Y *.txt C:\path\to\A\              I like that your copy command also copied what's in B not already in A.       cd B       for %i in (*.txt) do if not exist C:\path\to\A\%i copy %i C:\path\to\A\              To explain what I was doing before you provided that nice diff listing       and diff batch copy commands, and using the names for that diff file that       are in this thread...              Before, what I was doing was _manually_ creating the diff file on my own.       And then I was editing that diff file to create a new.bat on my own.              vim new.log       :%s/.*/echo n | copy & C\:\\path\\to\\A\\&       :w! new.bat              The explanation of that is ":" starts a command inside of vim.       The "%" says to run the command on every line of the file.       The "s/.*" says search for any character & then zero or any number of them.       The "/" means to replace what that search found with what comes next.       Next is what to replace it with (the ampersand being what was found).       The extra backslashes are to escape characters which have other meanings.              Where the resulting new.bat file contained the respective copy commands:       echo n | copy file1.txt C:\path\to\A\file1.txt       echo n | copy file2.txt C:\path\to\A\file2.txt       echo n | copy file3.txt C:\path\to\A\file3.txt              But your method is more elegant than my manual editing of the diff file       to turn that diff file of what's in B not yet in A into a batch copy file.              @echo off       cd C:\path\to\B       for %%i in (*.txt) do if not exist C:\path\to\A\%%i echo %%i >> new.log       for %%i in (*.txt) do if not exist C:\path\to\A\%%i copy %%i C:\path\to\A\              Thank you!       --       best regards,              Neil              --- SoupGate-Win32 v1.05        * Origin: you cannot sedate... all the things you hate (1:229/2)    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca