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,833 of 68,980   
   LangerTom to All   
   Re: Problem with file copying in Batch   
   21 Nov 21 09:13:48   
   
   From: hobby.tl@langer-online.net.invalid   
      
   Am 17.11.2021 um 00:44 schrieb John Stockton:   
   > On Friday, 12 November 2021 at 00:46:22 UTC, LangerTom wrote:   
   >   
   >> I hope that I have understood you correctly. If so the following snippet   
   >> shoud show you a solution for your problem. It works with 4 sub   
   >> routines, 3 of them used internally only, for an intermediate step to   
   >> process the name of the target directory. This routines use   
   >> call-by-reference method for returning results like PASCAL.   
   >   
   > The need is to truncate a filename immediately   
   >   before/after its final backslash.   
   >   
   > Thank you for your efforts.  Your code uses batch   
   > language features which I know nothing about,   
   > and I don't want to have code which I cannot read.   
   >   
      
   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   
      
   HTH Thomas   
      
   --- 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