home bbs files messages ]

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,135 of 42,547   
   Philip Herlihy to All   
   Re: List of NOT duplicate files   
   13 Mar 23 11:38:02   
   
   XPost: alt.comp.os.windows-10   
   From: PhillipHerlihy@SlashDevNull.invalid   
      
   In article , Neil wrote...   
   >   
   > I've been doing this manually but I'm asking if there is a better way.   
   >   
   > I have two folders of text files, some of which have duplicate file names.   
   > The _contents_ of those text files, even with the same name, are different.   
   > But everything is dependent only on the file names (not on their contents).   
   >   
   > Folder A is the master folder containing thousands of A\*.txt files.   
   > Folder B is the folder whose new files (only!) are added to folder A.   
   >   
   > That is, if a B\*.txt file name is already in folder A, it's not added.   
   > Only if a B\*.txt file name is NOT already in folder A, is it added.   
   > Folder A always grows but it never contains a duplicate file name from B.   
   >   
   > What I need is a list of the files that were in folder B that were not   
   > duplicates of what was already in folder A when they were copied/moved.   
   >   
   > Is there an easy way to obtain that list which is better than how I'm   
   > manually doing it today, which is to make a list of what file names are   
   > originally in A and I make a list of the file names in B that are left   
   > after I copy/move the files over without duplication and then I subtract   
   > one list from the other.   
   >   
   > Is there an easier way to get that list of what file names are in   
   > folder B that aren't yet in folder A when I move just those files over?   
      
   Robocopy (built-in to all recent versions of Windows) can do this.  It takes   
   work to get to a basic competence with it, but it's so useful that it's well   
   worth it.  There's a guide out there (Google Robocopy.doc) or type robocopy /?   
   into a command window.  There are a LOT of command options!   
      
   Essentially robocopy   will _selectively_ copy files from 1   
   to 2, only if they are newer or otherwise different.  Exactly how it chooses   
   this is controlled by the options.  Usefully, the /L option does all the   
   calculations but doesn't move anything.  Dangerously, the /MIR option deletes   
   anything in the target folder that wasn't found in the source folder.   
      
   The way I often use it is to navigate in a command window to my desktop, so job   
   files (described below) and log files are readily seen there.  I run:   
   robocopy    /SAVE:jobfile.rcj /QUIT   
   This creates a "job file" which can be re-run with this syntax:   
   robocopy /JOB:jobfile.rcj   
   You then edit the jobfile (double-colon comments out a line) to fool around   
   with the options, studying the output (you can usefully create a /LOG file and   
   /TEE the output to the command window).  When you're confident you have it   
   right, you remove the /L and the files get moved next time.   
      
   In your situation, you should pay particular attention to the file "classes":   
   Newer, Different, Older, etc, etc.  Robocopy will elegantly do exactly what you   
   want.  It's a utility I only occasionally use, but when I do it's absolutely   
   invaluable.   
      
   --   
      
   Phil, London   
      
   --- 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