home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   alt.msdos.batch.nt      Fun with Windows NT batch files      68,980 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 67,836 of 68,980   
   John Stockton to LangerTom   
   Re: Problem with file copying in Batch   
   21 Nov 21 15:22:25   
   
   From: dr.j.r.stockton@gmail.com   
      
   On Sunday, 21 November 2021 at 08:13:50 UTC, LangerTom wrote:   
   > Am 17.11.2021 um 00:44 schrieb John Stockton:   
   > > On Friday, 12 November 2021 at 00:46:22 UTC, LangerTom wrote:   
      
      
   > I found a solution for your problem, that ist very much simpler, smaller   
   > and faster than my last suggestion.   
   >   
   > Try:   
   >   
   >   
   > FOR /F "eol=; tokens=*" %%J IN (ZZZ\ZZZZ.TXT) DO (   
   > Xcopy /F %%J ZZZ\%%J\..\   
   > )   
   >   
   > This syntax addresses the path part only of your fully qualified   
   > file name ZZZ\%%J and adds the trailing back space missing   
   >   
   > .. is the representation of the parent part of a path and works on file   
   > names in fully qualified file names too.   
   >   
   > cd ..\.. will move upward two levels in a directory structure   
      
      
   It has taken a genius to think of something which is   
   perfectly obvious in hindsight!  It worked immediately;   
   but it put too much on the console, so I now have   
      
   @FOR /F "eol=; tokens=*" %%J IN (ZZZ\ZZZZ.TXT) DO @(   
   @echo     copy   MYSLIDES\%%J  to  MYSLIDES\ZZZ\%%J   
   @Xcopy %%J ZZZ\%%J\..\ > nul   
   )   
      
   which gives just the echoed line for each file copied.   
   It does give more if the apparent source file does not   
   exist; but that will not happen when I have completed   
   a recalcitrant piece of the preceding coding.   
      
   Thanks,   
      
   --   
     (c) John Stockton, near London, UK.  Using Google Groups.           |   
    Mail: J.R.""""""""@physics.org - or as Reply-To, if any.             |   
      
   --- 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