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 40,713 of 42,547   
   Tim Meddick to All   
   Re: Copy option   
   04 Aug 13 14:58:14   
   
   From: timmeddick@o2.co.uk   
      
   You could use Environment Variables to provide unique destination   
   filenames; such as the current date:   
      
   copy  filename.ext  filename_%DATE%.ext   
      
   ...which would result in an example filename, of the copied file;   
      
   copy MyNotes.doc  MyNotes_04-08-13.doc   
      
   ...in a batch file, this might look like the following;   
      
     @echo off   
     echo.   
     for %%I in (*.*) do call :SUB#1 %%I   
     goto :EOF   
      
     :SUB#1   
     if EXIST %1 echo "%~n1%~x1" "%~n1_%DATE%%~x1"   
      
   ==   
      
   Cheers,    Tim Meddick,    Peckham, London.    :-)   
      
      
      
    wrote in message   
   news:6ce31581-322a-4cbe-8288-708128970b84@googlegroups.com...   
   >I need to activate the feature of renaming files in case of copying files   
   >via windows environment that permit adding copy(1) , copy(2) to the new   
   >files in case if the same names found.   
   > Through a batch file how can we add that feature :   
   >   
   > copy oldfile newfile   
   >   
   >   
   > I need in case of newfile found to add a prefix to the old name :   
   > Copy(1)_newfile   
   > Copy(2)_newfile   
   > Copy(3)_newfile   
      
   --- 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