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 41,682 of 42,547   
   JJ to AlleyCat   
   Re: This Works Great, but...   
   13 Oct 18 19:14:21   
   
   XPost: alt.msdos.batch.nt   
   From: jj4public@vfemail.net   
      
   On Sat, 13 Oct 2018 02:41:36 -0500, AlleyCat wrote:   
   > if exist D:\Latest_MSI.gho for /f "tokens=1-5 delims=/ " %%d in ("%date%")   
   > do rename "D:\Latest_MSI.gho" %%e-%%f-%%g_MSI.gho   
   >   
   > That's part of a bacth file that I'm using to rename and move a ghost   
   > image when creating a new one.   
   >   
   > Can anyone re-write this to make the renaming be the date modified,   
   > instead of the current date?   
   >   
   > Thanks.   
      
   Use below. Change "echo ren" to "ren" to make it actually perform the file   
   rename instead of displaying the REN command line which is to be executed.   
      
   @echo off   
   setlocal   
   for %%N in (D:\Latest_MSI.gho) do (   
     for /f "tokens=1,2,3 delims=/ " %%X in ('echo %%~tN') do (   
       echo ren "%%N" "%%X-%%Y-%%Z_MSI.gho"   
     )   
   )   
      
   --- 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